有没有办法一起运行store_result和get_result [英] Is there a way to run store_result and get_result together
本文介绍了有没有办法一起运行store_result和get_result的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在同一查询中使用store_result()
和get_result()
,但是它说
I am trying to use store_result()
and get_result()
in the same query but it says
Call to a member function fetch_assoc() on boolean
此链接同时使用了他们,我想这对他有用.
This link has used both of them and I guess it is working for him.
这是我的代码
$stmtgetproducts = $mysqli->prepare("SELECT * FROM store_products sp
INNER JOIN store_product_categories spc ON sp.product_category=spc.id
WHERE sp.store_id = ? ORDER BY sp.product_views DESC");
$stmtgetproducts->bind_param("i",$storeid);
$stmtgetproducts->execute();
$stmtgetproducts->store_result();
$rows = $stmtgetproducts->num_rows;
$getproducts = $stmtgetproducts->get_result();
while($products = $getproducts->fetch_assoc()){
//Code to display rows.
}
推荐答案
要完成此问题.
推荐的方法来自Rajdeep Paul
The methods suceeded was from Rajdeep Paul
$getproducts = $stmtgetproducts->get_result();
$rows = $getproducts->num_rows;
这篇关于有没有办法一起运行store_result和get_result的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文