php store_result,PHP: mysqli_stmt::store_result - Manual
发布日期:2021-06-24 12:08:45 浏览次数:2 分类:技术文章

本文共 647 字,大约阅读时间需要 2 分钟。

Lost some hours to find out how to save multirows result of mysqli_stmt to array, when get_result prohibited.

Idea, which works is using store_result

$stmt=$this->mysqli->prepare("SELECT surname, name, user_id, last_m_own, last_m_str, role FROM users WHERE referer_id=(?)");

$stmt->bind_param('i',$referer_id);

$stmt->execute();

$stmt->store_result();

$stmt->bind_result($ans['surname'], $ans['name'], $ans['user_id'], $ans['last_m_own'], $ans['last_m_str'], $ans['role']);

$j=$stmt->num_rows;

for ($i=0;$i

$stmt->data_seek($i);

$stmt->fetch();

foreach ($ans as $key=>$value){

$result[$i][$key]=$value;

}

}

Hope will helpful for such newbies as me

转载地址:https://blog.csdn.net/weixin_32646781/article/details/116218315 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:php+facade模式怎么用,PHP设计模式之外观模式(Facade)入门与应用详解
下一篇:php有关于进程的概念,php 进程 线程 协程相关概念

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月08日 18时23分57秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章