我遇到了 MySQL 更新查询的问题,它说成功,但实际上并没有更新数据库记录。
require_once('auth.php');
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="sysadmin"; // Mysql password
$db_name="Elite"; // Database name
$tbl_name="Triage"; // Table name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$Reference=$_GET['Reference'];
$sql="UPDATE Triage SET directly='$directly' WHERE Reference='$Reference'";
$result=mysql_query($sql);
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}
else {
echo "ERROR";
}