$mysqli=new mysqli("localhost","root","snail","mysqldb");
$sql="update shop set name=?,price=? where id=?";
$stmt=$mysqli->prepare($sql);
//给每个占位符?传值(也叫参数绑定) i(整型) d(double) s(string) b(二进制,如图片、声音)
$stmt->bind_param("sdi",$name,$price,$id);
$name="zhangsan11111111";
$price=525.15;
$id=121;
$stmt->execute();
最佳答案