Return array from MySQL query


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $result = mysql_query($query) or die($query);
  2.  
  3. $returnarray = array ();
  4. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  5. $returnarray[] = $row;
  6. }
  7.  
  8. return $returnarray;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.