wrong parameter count?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Czar
Forum Commoner
Posts: 58
Joined: Sun Dec 29, 2002 11:17 am

wrong parameter count?

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mixed mysql_result ( resource result, int row [, mixed field])
result and row are required arguments.
Czar
Forum Commoner
Posts: 58
Joined: Sun Dec 29, 2002 11:17 am

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply