Return to Snippet

Revision: 15489
at July 7, 2009 15:28 by the_dev


Initial Code
while($rows[] = mysqli_fetch_assoc($result));
array_pop($rows);  // pop the last row off, which is an empty row

Initial URL

                                

Initial Description
Here is the correct way to turn your mysql results into an array.  Forget the other nonsense of useless code.  Why type out this long code: "for($i = 0; $array[$i] = mysqli_fetch_assoc($result); $i++) ;"  when you can accomplish the same thing with much less code.

Initial Title
Turn MySQL results into an array, the proper way!

Initial Tags
mysql, php

Initial Language
PHP