如何将一列mysql_query结果放入数组中? [英] How to get one column of mysql_query results into an array?
本文介绍了如何将一列mysql_query结果放入数组中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用mysql_query()
从MySQL表中选择单个列.已经有一个将结果放入数组的函数,还是我必须用mysql_fetch_array()
之类的东西遍历所有结果?
I'm selecting a single column from a MySQL table with mysql_query()
. Is there already a function for getting the results into an array, or will I have to iterate through all the results with something like mysql_fetch_array()
?
推荐答案
您必须进行迭代.
If you moved into the 21st century, and used mysqli, there's a mysqli_fetch_all() function.... and you'd be able to use prepared statements
这篇关于如何将一列mysql_query结果放入数组中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文