php - Get the full result -


Is there a PHP function to get the full result with a mysql query in a multi-dimensional array?

 Usually I have to do something like this: 

  $ query = mysql_query = ("Select * Table from");  SELECT * table from  

while ($ result = mysql_fetch_array ($ query) {echo $ result [0];}

< P>

If you are using a pdo mysql.

Otherwise you need to do it yourself. / P>

  $ query = mysql_query = ("from the table"); $ All_results = array (); while ($ result = mysql_fetch_array ($ query) {$ all_results [] = $ result;} print_r ($ All_results);  

The $ all_results variable will be a multi-dimensional array with all records.


Comments