Hi
I want to get table records all in 1 array. I used mysql_fetch_array() but it was returing the first record only
How can all records be stored in 1 array?
I have table: symbols1 and symbols2; I want to get all of their data and then use array_merge() to combine the data
Thanks for your help
How to get all rows in an array
Moderator: General Moderators
Re: How to get all rows in an array
mysql_fetch_array() will return one row as an array. The next time you call mysql_fetch_array() it will load the second row and so on until there are no more rows in the result set.
Use this:
Within the while loop you can merge your rows or whatever you like.
Use this:
Code: Select all
<?php
while ($row=mysql_fetch_array($result)){
// do stuff with new array: $row
}
?>