我怎样才能通过mysql_fetch_array()数组()传递mysql_fetch_array数组()
3
A
回答
5
做你的意思是:
$variable = mysql_fetch_array($result); //$variable is now an array
0
mysql_fetch_array()仅仅是输出数组的函数,这样你就可以只需将其连接到任何变量,就像这样:
$foo = mysql_fetch_array($bar);
15
如果你想使用它,你可能想while语句中指定多个结果。如
$query = mysql_query("SELECT * FROM users");
$resultSet = array();
while($result = mysql_fetch_array($query))
{
$resultSet[] = $result;
}
+1
这真棒,我用这个将mysql结果转换为数组,同时我也可以将结果保存到json中以最大限度地减少mysql服务器的使用 – 2017-03-23 07:59:34
4
一个短版,增加了多个结果到一个数组与while语句
while($r[]=mysql_fetch_array($query));
array_pop($r); // mysql_fetch_array() moves the internal data pointer ahead so last row should be cut off
相关问题
- 1. 递增mysql_fetch_array?
- 2. 在JSON中传递数组的数组
- 3. 将PHP数组传递到Javascript数组
- 4. JavaScript数组传递到PHP数组中
- 5. 使用json传递数组?
- 6. 传递数组Xamarin的Android
- 7. SAS:传递数组名称
- 8. 传递多维数组C++
- 9. 数组如何传递?
- 10. 你如何传递数组?
- 11. 如何传递数组?
- 12. C++数组传递困境
- 13. 传递数组通过AJAX
- 14. 传递一个2D数组
- 15. 传递数组线程
- 16. 传递数组到外地
- 17. 在C中传递数组#
- 18. 将数组传递给Cuda
- 19. 轨传递数组的link_to
- 20. 传递数组从形式
- 21. 使用COM传递数组?
- 22. 传递二维数组
- 23. 传递数组到窗口
- 24. 传递两个数组
- 25. 传递数组到select_tag
- 26. 传递数组到pthread_create
- 27. 传递空数组ArrayAdapter.createResource
- 28. 在java中传递数组
- 29. 传递数组到功能
- 30. 数组和参考传递
你是什么意思传递?你究竟想要完成什么? mysql_fetch_array()已经返回一个数组。 – mauris 2009-12-25 09:05:44