我已准备好阅读所有其他主题但却找不到解决方案。这是我的代码
style="top: 0px; left: -135px; width: 1210px; height: 806px; position: relative;"
如果我改为
$DevolverUser = $_SESSION['DevolverUser'];
$DevolverPaswword = $_SESSION['DevolverPaswword'];
$query = " select puededevolver ".
" from b_usuarios ".
" where codpais = ? ".
" and usuario = 'usuario' ".
" and PASSWORD = PASSWORD('password')";
$stmt = $con ->prepare($query);
$stmt->bind_param("s", $pais );
$stmt->execute();
$stmt->bind_result($dato);
while($stmt->fetch()){
echo $dato;
}
它不起作用,如果我的特性只是绑定用户或只是传递没有工作,Ony使用$ pais。我已经准备好检查我的所有变量都是字符串。我不知道还有什么要检查,请帮忙。
答案 0 :(得分:1)
编辑:我的不好,我以为您正在使用PDO
- 而您似乎使用mysqli
。
不是$stmt->bind_param()
,而是$stmt->bindParam()
;据我所知,$stmt->bind_result()
之类的东西根本不存在。我也想知道你想在SQL中用PASSWORD(...)
实现什么。到目前为止,我修复了所有内容:
$DevolverUser = $_SESSION['DevolverUser'];
$DevolverPaswword = $_SESSION['DevolverPaswword'];
$query = " select puededevolver ".
" from b_usuarios ".
" where codpais = :codpais ".
" and usuario = :usuario ".
" and PASSWORD = :password ";
$stmt = $con->prepare($query);
$stmt->bindParam(":codpais", $pais);
$stmt->bindParam(":usuario", $DevolverUser);
$stmt->bindParam(":password", $DevolverPaswword);
$stmt->execute();
while($row = $stmt->fetch()){
echo $row["puededevolver"];
}