I'm getting a result set from a MySQL query but I'm having trouble dropping that into an array.
Code:
$countryquery = "SELECT * FROM count_list";
$countryresult = mysql_query($countryquery) or die(mysql_error());
while ($querydata = mysql_fetch_array($countryresult)){
extract($querydata);
$c[] = array ($count_name);
}
foreach ($c as $cp){
echo ("$cp<br>");
}
This gets me "Array" printed many times.
When I try this:
Code:
while ($querydata = mysql_fetch_array($countryresult)){
extract($querydata);
$c = array ($count_name);
}
foreach ($c as $cp){
echo ("$cp<br>");
}
I get the last item in the array displayed but nothing else. I'm assuming PHP is copying over the same variable again and again until it hits the last value and displays that on the screen.
Can anyone offer suggestions on how to change this code to create the array I need?