Jump to content

[SOLVED] Problem with array


DEVILofDARKNESS

Recommended Posts

okay I have the following piece of code:

$query = "SELECT `nation_id` , COUNT( `region_id` ) AS `regions_count` FROM `regions` WHERE in_use = 'Yes' GROUP BY `regions`.`nation_id` ORDER BY`regions_count` DESC";
		$result = mysql_query($query);
		while($array = mysql_fetch_array($result)){
			//$idnation = $array['nation_id'];
			$query = "SELECT nation_name FROM nations WHERE nation_id = '" . $array['nation_id'] . "'";
			$result = mysql_query($query);
			list($namenation) = mysql_fetch_row($result);
			echo $namenation;
		}

 

But this gives only one name, if don't do the second query but direct output the $array['nation_id'] I DO get more rows, so Where is the problem?

 

*This can be more related to Mysql Forum but I wasn't sure.  So sorry if it is

Link to comment
https://forums.phpfreaks.com/topic/173003-solved-problem-with-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.