时间:2021-07-01 10:21:17 帮助过:30人阅读
$db = new mysqli("localhost", "xx","xxxxxxx","books");
$insert_str = "insert into customers(name,address,city) values(?,?,?)";
$stmt = $db->prepare($insert_str);
$stmt->bind_param("sss","john","street one","beijing");
$stmt->execute();
echo $stmt->affected_rows;
$db = new mysqli("localhost", "xx","xxxxxx","books");
$insert_str = "insert into customers(name,address,city) values(?,?,?)";
$stmt = $db->prepare($insert_str);
$name ="john";
$address = "street one";
$city = "beijing";
$stmt->bind_param("sss",$name,$address,$city);
$stmt->execute();
echo $stmt->affected_rows;