[英]What is the easiest way to turn a mysql result variable into a multidimensional array in php?
What is the easiest way to turn a mysql result variable into a multidimensional array in php? 在php中将mysql结果变量转换为多维数组的最简单方法是什么?
Thanks 谢谢
Run mysql_fetch_assoc in a loop. 循环运行mysql_fetch_assoc 。
while ($row = mysql_fetch_assoc($result)) {
$table[] = $row;
}
print_r($table);
如果您碰巧正在使用mysqli扩展名和php 5.3,则可以使用http://us2.php.net/manual/en/mysqli-result.fetch-all.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.