php
$conn = new mysqli('localhost','root','','orders'); //连接
$prepare = "insert into t100 values (?,?,?)";//预设插入sql
$bind = $conn->prepare($prepare);
$t1 = NULL;
$t2 = 'Www';
$t3 = date('Y-m-d H:i:s');
$bind->bind_param('iss',$t1,$t2,$t3); //绑定
//注意iss:
//i为int,s为string类型;意思是强制这几个参数的类型
$bind->execute();//执行
$prepare = "select * from t100"; //准备要查询的语句
$bind = $conn->prepare($prepare);//预处理
$t1 = 10;
$bind->execute();//执行
$bind->bind_result($id, $name, $date);//将字段列绑定到变量上
$bind->store_result();//获取结果集
while ($bind->fetch()){//遍历
printf("%d == %s == %s
",$id,$name,$date);//输出
}