php访问mysql数据库,如何按名称绑定参数?只支持匿名绑定吗?
seai 2010-07-08 08:14:48 <?php
$mysqli=new mysqli("localhost","root","123","books");
if($stmt=$mysqli->prepare("SELECT id FROM computers WHERE id LIKE ?"))
{
$stmt->bind_param("s",$code); //这里只是匿名绑定啊。。。
$code='29';
$stmt->execute();
$stmt->bind_result($col1);
while($stmt->fetch()){
printf("%s ",$col1);
}
$stmt->close();
$mysqli->close();
}
?>