|
-
Mar 6th, 2005, 12:56 PM
#1
Thread Starter
Fanatic Member
COUNT SELECT statement
Hi,
I am trying to count the results you will get from my query, but it doesn't seem to let me.
PHP Code:
$query = mysql_query("SELECT COUNT(*) FROM messages WHERE username = '".$_SESSION[username]."' AND read = '0'", $db);
When I try doing a result on that (eg. $result = mysql_result($query, 0, 0);), it gives me a parse error:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource
But if I do:
PHP Code:
$query = mysql_query("SELECT COUNT(*) FROM messages WHERE username = '".$_SESSION[username]."'", $db);
it allows it! Which would be ok if I didn't need to specify "read = '0'" too, but I do.
Can anyone help me here? I'm new to php and I'm not sure what I'm doing wrong. If no one can help, I'll try a different, more sloppy, method.
Last edited by LITHIA; Mar 6th, 2005 at 04:36 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|