当我在 localhost 中运行以下代码时,它可以工作,但是当我在线托管它时,它会出错。
if(isset($_POST['congressman'])){
$congressman = $_POST['congressman'];
$no_of_votes = mysql_result(mysql_query("SELECT no_of_votes FROM `tbcandidates` WHERE `identification_no`=$congressman"),0) + 1;
$query=mysql_query("UPDATE tbcandidates SET no_of_votes = '$no_of_votes' WHERE identification_no = $congressman");
这一行:
no_of_votes = mysql_result(mysql_query("SELECT no_of_votes FROM `tbcandidates` WHERE `identification_no`=$congressman"),0) + 1;
它说 mysql_result(): 提供的参数不是有效的 MySQL 结果资源等。