Jump to content

[SOLVED] output count


leequalls

Recommended Posts

I am trying to get a count of how many messages a user has in the database this is the code I have:

 

$mail = mysql_query("select count(*) from mail where to='$username'");
$inbox = mysql_result($mail);
echo("View Inbox ($inbox)<br/>");

 

I get an error with this Warning: Wrong parameter count for mysql_result() what am I doing wrong?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/167939-solved-output-count/
Share on other sites

see what error you get

$SQL = "select count(*) from mail where to='$username'";
$mail = mysql_query($SQL) or die(mysql_error().$SQL);
$inbox = mysql_result($mail, 0)
echo("View Inbox ($inbox)<br/>");

 

remember TO check for reserved words, these can be resolved via back ticks (`) but its better to change the field name

 

EDIT: MySQL 5.1 section 8.3. Reserved Words

Link to comment
https://forums.phpfreaks.com/topic/167939-solved-output-count/#findComment-885747
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.