I am using a mysql_query and mysql_fetch_array in order to return an array of values to use in a foreach loop.
For some reason only the last inputted row is returned by the query when I print_r the array that is returned.
What I am doing is:
$query = mysql_query("SELECT * from table_name;");
$returned_array = mysql_fetch_array($query);
print_r($returned_array)
Say for example there are 4 values in the table (a, b, c, d), only the last would be returned to me, so what I see is: Array ( [0] => d ).
How do I go about fixing this or am I doing something wrong?
E_DEPRECATEDnotice: please don't usemysql_*, the extension has been deprecated years ago. Learn to usePDOormysqli_*instead (the replacement extensions)$returned_array - mysql_fetch_array($query);instead of=you are using-