首頁 >後端開發 >php教程 > mysqli扩充

mysqli扩充

WBOY
WBOY原創
2016-06-13 12:33:33818瀏覽

mysqli扩展

<br />
$conn = new mysqli('localhost','root','123','zx','3306');<br />
<br />
if (mysqli_connect_errno()) {<br />
    printf("Connect failed: %s\n", mysqli_connect_error());<br />
    exit();<br />
}<br />
<br />
<br />
$prepare = $conn -> prepare("INSERT INTO  test  (uid,name) VALUES('?','?')");<br />
<br />
$num = 12;<br />
<br />
$hanzi = "xiha";<br />
<br />
$prepare -> bind_param('is',$num,$hanzi);<br />
<br />
<br />
<br />
$prepare -> execute();<br />
<br />
<br />


test表字段,uid int(11) name varchar(30)

Warning: mysqli_stmt::bind_param() [function.mysqli-stmt-bind-param]: Number of variables doesn't match number of parameters in prepared statement in 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn