标签:des blog http os ar 2014 sp log c
<?php $mysqli=new mysqli("localhost", "root", "123456", "xsphpdb");
$stmt=$mysqli->prepare("select id, name, price, num, desn from shops where id>?");
$stmt->bind_param("i", $id);
$stmt->bind_result($id, $name, $price, $num, $desn);
$id=99;
$stmt->execute(); $stmt->store_result(); //一次性将结果都取过来 重要
//字段信息 $result=$stmt->result_metadata(); while($field=$result->fetch_field()){ echo $field->name."--"; } echo ‘<br>‘; //记录信息 //$stmt->data_seek(2); while($stmt->fetch()){ echo "$id--$name---$price---$num---$desn <br>"; }
echo "记录总数:".$stmt->num_rows;
$stmt->free_result();
$stmt->close();
标签:des blog http os ar 2014 sp log c
原文地址:http://www.cnblogs.com/toward-the-sun/p/3970829.html