Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

count statement

$
0
0

What I'm trying to say here is, if the column STATUS is counted and in that column there are no rows that contain "ONLINE"  then I want the result to show as "There Are Currently No Users Online" else if there are rows in that column that have "ONLINE" in them then it show them in a list eg. DAVE, STUART, PAUL, DONNA

if (count($contents[status]='online') === 0) {

echo "<p align=center> There Are No Users Currently Online</p>";

}
else
{
$resultcont = mysql_query("SELECT * FROM userdb where status='online' order by id DESC LIMIT 0,15");
while($contents = mysql_fetch_array($resultcont))
{

echo "<a href=http://www.sentuamessage.com/profile?who=$contents[id]>$contents[name]</a>";
 }

this is how I thought it would be. I realise that it is wrong but trying to figure how I would get this working. Any help?

 

I did have it originally as "if (count($contents[online]) === 0) {" but realised this was wrong as there is no column called online.

 

 

 


Viewing all articles
Browse latest Browse all 13200

Trending Articles