Heim >Backend-Entwicklung >PHP-Tutorial > mysqli扩充
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 />