PHPi 5.2.6中的MySQLi关联数组结果

时间:2014-10-23 17:12:45

标签: php mysql mysqli

有没有办法使用PHP 5.2.6在MySQLi中获取结果的关联数组?

我知道PHP 5.3+可以使用get_result()。我知道PHP 5.2.6中有bind_result()虽然查询中可以有任意数量的列(不是一个固定的数字。)

一直把头发拉过来,任何帮助都会受到赞赏!

2 个答案:

答案 0 :(得分:2)

程序:

mysqli_fetch_assoc ( mysqli_result $result )

面向对象:

mysqli_result::fetch_assoc ( void )

更多信息:http://php.net/manual/en/mysqli-result.fetch-assoc.php

答案 1 :(得分:0)

你的朋友是mysqli_fetch_assoc。它将结果行作为关联数组获取。

来自doumentation ..

Returns an associative array of strings representing the fetched row in the result set, where each key in the array represents the name of one of the result set's columns or NULL if there are no more rows in resultset