I'm used to working with old baby ASP, but have started to learn PHP.

With this bit of PHP, I am listing the output from one table, and for each loop through it, am running an SQL to run an SQL COUNT statement.

When I output the SQL statement from the loop, and run it in MySQL, it generates an output, but on the php page, when I echo the 'count_check' variable, it doesn't contain anything.

No doubt that's because I'm making a stupid error, but I can't see what it is.

This is the code:

PHP Code:

"SELECT fldID, fldCountry FROM fett_country_list ORDER BY 2";
$result = @mysql_query($query);

if (
$result) {
"<p><table cellpadding='5' cellspacing='1' width='100%'>" .
"<tr><th>Country Name</th><th>Count</th><th>Edit</th><th>Delete</a></th></tr>";

$row mysql_fetch_array($resultMYSQL_ASSOC))

$CountryID =    $row['fldID'];
$CountryName =  $row['fldCountry'];

$query2 "select fett_country_list.fldCountry, count(*) AS count_check FROM fett_county_list, fett_country_list WHERE fett_county_list.fldCountryID = fett_country_list.fldID and fett_country_list.fldID = $CountryID GROUP BY fldCountryID;";
$result2 = @mysql_query($query2);

    if (
$result2) {
$count_check $row['count_check'];
"<p>Count Check: $count_check</p>";

"<tr>" .
"<td>$CountryName</td>" .
"<td>$count_check</td>" .
"<td><a href='manage-country-edit.php?id=$CountryID'>edit</a></td>" .
"<td><a href='manage-country-delete.php?id=$CountryID'>delete</a></td>" .
"</tr>" ;


else {
"<p>No data</p>";