View Full Version : Wrong parameter count for mysql_query

06-05-2006, 06:18 PM
this is my code:

$biggestreferer = 'SELECT referer, COUNT(*) AS p FROM admin_stats WHERE referer != "" GROUP BY referer ORDER BY p DESC LIMIT 1';
$biggestreferer = mysql_query($biggestreferer) or exit (mysql_error());
$biggestreferer = mysql_result($biggestreferer);

and it is for some reason returning a php error, not a mysql error. Mysql doesn't have a problem with the query and i have tried it in phpmyadmin and it works. Here is my php error:

Warning: Wrong parameter count for mysql_result() in /raid5/home/eli/public_html/newhome/administration/stats.php on line 35

What is the problem with this?

06-05-2006, 06:25 PM
you forget to pass row param in mysql_result statement.

$biggestreferer = mysql_result($biggestreferer,0);

06-05-2006, 06:35 PM

Always try reading the php manual. It tells you exactly which parameters are needed.