I have two queries. One of them makes sense to me, the other don\'t. First one:
SELECT gender AS \'Gender\', count(*) AS \'#\'
FROM registrations
GR
Coz when you use JOIN method, the following NULL element of array will have value of previous NOT NULL element. But Im not sure. Thats my experience when I use it in PHP.
hm... there is another problem... 'Country' canot be because it is name of table. So change for something else. Then last result will display NULL. Here is my proposal:
$result = mysql_query("SELECT c.printable_name AS 'countryp', count(*) AS '#'
FROM registrations r, country c WHERE r.country = c.country_id
GROUP BY countryp WITH ROLLUP");
while($row = @mysql_fetch_array($result)) {
$r1 = $row["countryp"];
$r2 = $row["#"];
if ($r1 == NULL) $r1 = 'Total';
echo "$r1 $r2
";
}