时间:2021-07-01 10:21:17 帮助过:2人阅读
输出数据
/*
利用mysqli扩展来绑定结果
*/
//新建服务器连接
$mysqli=new mysqli('localhost','root','root','searcdb');
//创建查询
$query="SELECT adminName,adminPwd FROM admininfo";
//创建语句对象
$stmt=$mysqli->stmt_init();
//为执行准备语句
$stmt->prepare($query);
//执行语句
$stmt->execute();
//绑定结果参数
$stmt->bind_result($name,$pwd);
//循环处理结果并
function selectLink($oid){
$sql = "select o.oid,l.lid,c.cid,comName,comPrice,ordTime
from mis_order o,mis_link l,mis_commodity c
where o.oid=l.lid and c.cid=l.cid and o.oid=?";
$stmt = $this->mysqli->prepare($sql);
$stmt->bind_param("i",$oid);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($oid,$lid,$cid,$comName,$comPrice,$ordTime);
$rows = $stmt->affected_rows;
if($rows > 0){
$arrLink = array();
while($stmt->fetch()){
$arr = array(
"oid" => $oid,
"lid" => $lid,
"cid" => $cid,
"comName" => $comName,
"comPrice" => $comPrice,
"ordTime" => $ordTime
);
array_push($arrLink,$arr);
}
return $arrLink;
}else{
echo "查询订单明细失败!
";
}
}