上我有一個錯誤說調用一個成員函數mysql_affected_rows()函數的非對象
調用一個成員函數mysql_affected_rows()函數在C非對象:\ XAMPP \ htdocs中\ 189線上的initializr \ search.php
當我點擊我的提交按鈕。
if(isset($_POST['select'])) {
$studId = $_REQUEST['studid'];
foreach ($studId as $ch) {
$result = $mysqli->query("INSERT INTO tbl_tempCand (datetime, names) VALUES (CURRENT_TIMESTAMP(), '".$ch."')");
//this is my line 189 error
if($row->mysql_affected_rows($result)==0) {
header("Location: registercand.php");
} else {
echo "nothing happen";
}
}
}
這是爲什麼?
首先,請不要使用mysql_ *功能,它們'已正式棄用。其次,您的查詢似乎對SQL注入攻擊開放。改用準備好的陳述或參數化查詢。 –