我在PHP 5.6.31和mysql:5.7.19上出错,我使用mysqli
mysqli_stmt_bind_result():绑定变量数与预准备语句中的字段数不匹配
使用此代码:
$query = "UPDATE membres
SET sessionid = ?
WHERE id = ?
AND username = ?";
// Type
$type = "iis";
if (database::query3p($requete, $sessionid, $id, $username, $type, $connection)) {
return true;
} else {
return false;
}
query3p调用:
public static function query3p($requete, $par1, $par2, $par3, $type, $connection) {
$prepa = mysqli_stmt_init($connection);
mysqli_stmt_prepare($prepa, $requete);
mysqli_stmt_bind_param($prepa, $type, $par1, $par2, $par3);
$reussite = mysqli_stmt_execute($prepa);
mysqli_stmt_store_result($prepa);
// I got an error on this line :
mysqli_stmt_bind_result($prepa, $par1, $par2, $par3);
$stockage = mysqli_stmt_fetch($prepa);
mysqli_stmt_close($prepa);
if ($reussite == true && $stockage == true) {
return array($par1, $par2, $par3);
} else {
return false;
}
}
我试图只放一个var或两个但是代码不能正常工作,我指定我需要这行。