mengedit fungsi.php

parent d1ea55f1
<?php <?php
global $conn; global $conn;
$conn = mysql_connect("localhost", "root", ""); $conn = mysqli_connect("localhost", "p1d3ti05", "Fredrick8");
if(!$conn){ if(!$conn){
die("database connect problem"); die("database connect problem");
} }
$db_use = mysql_select_db("cafe_db", $conn) or die ("select db problem!!"); $db_use = mysqli_select_db($conn, "p1d3ti05_cafedb") or die ("select db problem!!");
function execQ($strQ){ function execQ($strQ){
global $conn; global $conn;
$res = mysql_query($strQ, $conn); $res = mysqli_query($strQ, $conn);
return $res; return $res;
} }
...@@ -62,9 +62,9 @@ global $conn; ...@@ -62,9 +62,9 @@ global $conn;
$resItem = execQ($strQ); $resItem = execQ($strQ);
if(mysql_num_rows($resItem)!=0){ if(mysqli_num_rows($resItem)!=0){
$ret = array(); $ret = array();
while($data = mysql_fetch_assoc($resItem)){ while($data = mysqli_fetch_assoc($resItem)){
array_push($ret, array( array_push($ret, array(
'id' => $data['id'], 'id' => $data['id'],
'name' => $data['name'], 'name' => $data['name'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment