edit

parent aff6e1e9
<?php <?php
$database = new mysqli('127.0.0.1', 'root', '', 'cafe_db'); $database = new mysqli('127.0.0.1', 'root', '', 'p1d3ti05_cafedb');
\ No newline at end of file \ No newline at end of file
<?php <?php
global $conn; global $conn;
$conn = mysqli_connect("localhost", "root", ""); $conn = mysqli_connect("localhost", "p1d3ti05", "Fredrick8");
if(!$conn){ if(!$conn){
die("database connect problem"); die("database connect problem");
} }
$db_use = mysqli_select_db($conn,"cafe_db") 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( $conn, $strQ);
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