phpのbind_paramの問題、初心者がアドバイスを求めています
ここで準備ができたことを学び、次のコードを入力して実行しました
<br />$db = new mysqli("localhost", "xx","xxxxxxx","books");<br /> $insert_str = "insert into customers(name,address,city) values(?,?,?)";<br /> $stmt = $db->prepare($insert_str);<br /> $stmt->bind_param("sss","john","street one","beijing");<br /> $stmt->execute();<br /> echo $stmt->affected_rows;<br />
<br />$db = new mysqli("localhost", "xx","xxxxxx","books");<br /> $insert_str = "insert into customers(name,address,city) values(?,?,?)";<br /> $stmt = $db->prepare($insert_str);<br /> $name ="john";<br /> $address = "street one";<br /> $city = "beijing";<br /> $stmt->bind_param("sss",$name,$address,$city);<br /> $stmt->execute();<br /> echo $stmt->affected_rows;<br />