脚本宝典收集整理的这篇文章主要介绍了php – 为什么mysqli num_rows总是返回0?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
if($stmt = $MysqLi->PRepare("SELECT id,tITle,visible,parent_id From content WHERE parent_id = ? ORDER BY page_order ASC;")){ $stmt->bind_param('s',$data->id); $stmt->execute(); $num_of_rows = $stmt->num_rows; $stmt->bind_result($child_id,$child_title,$child_visible,$child_parent); while($stmt->@R_777_796@){ //code } echo($num_of_rows); $stmt->close(); }
为什么不显示正确的数字?
MySqli_Stmt::store_result()
:
if($stmt = $MysqLi->prepare("SELECT id,$data->id); $stmt->execute(); $stmt->Store_result(); <-- This needs to be called here! $num_of_rows = $stmt->num_rows; $stmt->bind_result($child_id,$child_parent); while($stmt->fetch()){ //code } echo($num_of_rows); $stmt->close(); }
请参阅the docs on MySQLi_Stmt->num_rows
,它说它在页面顶部附近(在主要描述块)…
以上是脚本宝典为你收集整理的php – 为什么mysqli num_rows总是返回0?全部内容,希望文章能够帮你解决php – 为什么mysqli num_rows总是返回0?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。