SELECT Count - solved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the debug advice - I will start using my_sql_error

First I got this error:
Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause

So the correct code ended up:

$sql = "SELECT COUNT(bandid), genre
FROM bands, genre
GROUP BY genre";

$result=mysql_query($sql) or die(mysql_error());

$num=mysql_fetch_row($result);

echo $num[0];

while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}


Thanks guys


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux