仅使用MySQLi获取一行 [英] Fetching one row only with MySQLi
本文介绍了仅使用MySQLi获取一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何仅使用MySQLi提取一个索引行?我目前正在这样做:
How can I only fetch one INDEXED row with MySQLi? I'm currently doing this:
$row = $result->fetch(MYSQLI_ASSOC);
$row = $row[0];
还有另一种方法吗?
我知道mysqli_fetch_row,但是它不返回关联数组.
I'm aware of mysqli_fetch_row but it doesn't return an associative array.
推荐答案
使用$row = $result->fetch_assoc();
-与fetch_row()
相同,但返回一个关联数组.
Use $row = $result->fetch_assoc();
- it's the same as fetch_row()
but returns an associative array.
这篇关于仅使用MySQLi获取一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文