我在我的代码中将MySQL更改为MySQLi
BEFORE:mysql(工作正常)
$set = "costAlertVar ='', costAlertSend = ''";
$eintrag = "UPDATE ".$dbprfx."_users SET $set WHERE connection = '$userConnection'";
$eintragen = mysqli_query($eintrag) or die("Error:".mysql_error());;
现在:mysqli(不工作)
$sql = "UPDATE ".$dbprfx."_users SET costAlertVar = ?, costAlertSend = ? WHERE connection = ?";
$eintrag = $db->prepare( $sql );
$eintrag->bind_param('sss','','',$userConnection);
$eintrag->execute();
$eintrag->close();
答案 0 :(得分:1)
mysqli::bind_param
使用参数作为引用,因此您必须传递可用作引用的值(即变量)。
$costAlertVar = '';
$costAlertSend = '';
$eintrag->bind_param('sss',$costAlertVar,$costAlertSend,$userConnection);