Page 1 of 1

wrong parameter count?

Posted: Fri Jul 30, 2004 1:21 pm
by Czar
I get following errors no matter what i do.

Warning: Wrong parameter count for mysql_result()

from these lines:

Code: Select all

<?php
$sql1 = mysql_query("SELECT a FROM d_poll1") or die(mysql_error());
$count1 = mysql_result($sql1) or die(mysql_error());
?>
In DB i have a default value of 0. Table is a poll table which increases vote value every time a vote is cast. Is there any other way to do this?

I would then use the

Code: Select all

<?php
$count1
?>
value to give a width to a TD block to represent a vote value...

Thanks for any help...
Rgds: Henri

Posted: Fri Jul 30, 2004 1:26 pm
by feyd
mixed mysql_result ( resource result, int row [, mixed field])
result and row are required arguments.

Posted: Fri Jul 30, 2004 1:35 pm
by Czar
Thanks. Got that, errors gone, but code execution now stops after

Code: Select all

<?php
$sql1 = mysql_query("SELECT a FROM d_poll1") or die(mysql_error());
?>
8O ???
The variable wont take any argument. I tried to echo it's value and got nothin. As i mentioned, there's a default value of 0 in DB... I increased the value manually and it works, but why not wit 0?

Posted: Fri Jul 30, 2004 1:51 pm
by feyd
depending on how you echo'd it, the engine may have chosen not to actually write the number out as zero, empty string, null, and false, are all considered empty values to several functions unless you do some explicit stuff.