Posted By

apro2000 on 03/14/09


Tagged

mysql php array into query values assign


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

lajevardi


Query into Array


 / Published in: PHP
 

  1. function query_into_array($query){
  2. settype($retval,"array");
  3. $result= mysql_query($query);
  4. $y=mysql_num_rows($result);
  5. $k=mysql_num_fields($result);
  6. for($i=0;$i<$y;$i++){
  7. for($j=0;$j<$k;$j++){
  8. $retval[$i][mysql_field_name($result,$j)] = mysql_result($result,$i, mysql_field_name($result,$j));
  9. }
  10. }
  11. return $retval;
  12. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: NeoBlack on March 14, 2009

function queryintoarray($query) { $res = mysqlquery($query); $return = array(); while ($row = mysqlfetch_assoc($res) { $return[] = $row; } return $return; }

You need to login to post a comment.