[英]error in a boolean - mysqli
i get an error in this code (comment in the code): 我在此代码中出现错误(代码中的注释):
if (checkBd ($sql, $db, $valor, $codePass)){
($sql = $db->prepare("UPDATE users SET activation = ? WHERE activationLink=?"));
$valor="1";
$sql->bind_param('is', $valor, $codePass);
$sql->execute();
$sql->bind_result($valor, $codePass); //Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn't match number of fields in prepared statement
if ($sql->fetch()) {
header("location: index.php");
return true;
}
else {
echo "no";
return false;
}
$sql->close();
$db->close();
}
what is the possible problem in the script? 脚本中可能存在什么问题? an another question, is this way correct to update a boolean?
另一个问题,以这种方式更新布尔值正确吗?
thanks 谢谢
I cannot retrieve a result from an UPDATE query. 我无法从UPDATE查询中检索结果。
solved with 解决了
if (checkBd ($sql, $db, $codePass)){
$valor=1;
($sql = $db->prepare("UPDATE users SET activation=? WHERE activationLink=?"));
$sql->bind_param('is', $valor, $codePass);
$sql->execute();
header("location: index.php");
return true;
}
else {
echo "no";
return false;
}
$sql->close();
$db->close();
Remove the quotes around your variables as they're not needed. 删除不需要的变量周围的引号。
If $valor is = 1 always you probably want to pass it as an integer. 如果$ valor = = 1,则始终可能希望将其作为整数传递。
$sql->bind_param('is', $valor, $codePass);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.