Jump to content

return SPECIFIC sql results


avenged

Recommended Posts

I don't understand your question. You have a query that will return ONLY rows where the field named reciever contains the value of $userid. So what would you like to see that's only equal to 1?
[code]
"SELECT * FROM pm WHERE reciever='$user_id' AND somethingelse = '1'";[/code]
ok. I have written a function for my private messaging system that I have written. It's supposed to return the total number of PM's a user has in his inbox.

[code]
function getTotalPM($id)
{
    $pm_query = "SELECT * FROM pm WHERE reciever='$id'";
    echo mysql_num_rows(mysql_query($pm_query));
}
[/code]

What I want to know is if I can limit the results that this function returns to ones that only have the value of 1(in this case, PM's that have not been read) so I can then make a new function(getNewPM()) to return the number of unread PM's the user has. How would I modify this function to return the intended results?

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.