$mysqli= new mysqli("localhost","root","123456","xsphpdemo");
if(mysqli_connect_errno()){
echo "连接失败
".mysqli_connect_error();
}
$stmt=$mysqli->prepare("select id name price num desn from shop where id>?");
$stmt->bind_param("i",$id);
$stmt->bind_result($id,$name,$price,$num,$desn);
$id="10";
$stmt->execute();
$stmt->store_result();
while($stmt->fetch()){
echo "$id -- $name -- $price -- $num -- $desn
";
}
echo $stmt->num_rows;
$stmt->close();
执行Var_dump("select id name price num desn from shop where id>?")
布尔型值是假
好像$mysqli->prepare()语句执行不成功,不知道为啥
"select `id`, `name`, `price`, `num` ,`desn` from shop where id>?"
echo $stmt->error; 有错误信息吗
echo $stmt->error; 有错误信息吗
echo $stmt->error; 有错误信息吗
$stmt->bind_param("i",$id);$stmt->bind_param(1,$id);
字段没有隔开
$stmt=$mysqli->prepare("select id, name, price, num, desn from shop where id>?");
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号