這是我的PHP代碼到目前爲止mysql_fetch返回不定值
<?php
$con=mysqli_connect("host","user","pass","db_name");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result_set = mysqli_query($con,"SELECT points FROM total WHERE id = 1");
$row = mysql_fetch($result_set);
$old_total = $row['total'];
$new_total = $old_total + $_REQUEST['total'];
mysqli_query($con,"UPDATE total SET points = $new_total WHERE id = 1");
mysqli_close($con);
?>
當我運行這一點,返回此錯誤: 調用未定義功能mysql_fetch()我失去了一些東西?
我混合3個回答正確的代碼...感謝所有: '$ result_set = mysqli_query($ CON」 SELECT points FROM total WHERE id = 1「); $ row = mysqli_fetch_assoc($ result_set); $ old_total = $ row ['points']; $ new_total = $ old_total + $ _REQUEST ['total']; mysqli_query($ con,「UPDATE total SET points = $ new_total WHERE id = 1」); mysqli_close($ con); ?> – user2125726 2013-03-08 05:03:37