我正在尝试将我的 php 脚本转换为使用准备好的语句,它给了我一个错误....有人知道出了什么问题吗?
<?php
define("DB_DSN","xxx");
define("DB_HOST","xxx");
define("DB_USER","xxx");
define("DB_PASS","xxx");
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('Could not connect: ' . mysql_error());
mysql_select_db(DB_DSN) or die('Could not select database');
$stmt = $con->prepare("UPDATE Level01 SET Deaths=:Deaths WHERE DeathID= :DeathID");
$stmt->bindParam(':Deaths', $deaths);
$stmt->bindParam(':DeathID', $id);
$id = base64_decode($_GET["id"]);
$deaths = base64_decode($_GET["deaths"]);
$uresult = $stmt->execute();
if(! $uresult )
{
die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($con);
exit;
这是我的错误:致命错误:在非对象上调用成员函数 prepare()