Search
Left Quote    Black holes are where God divided by zero.
- Steven Wright    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: user ionline
  This user is offline  ki
  Subject: "user ionline" Posted: @ 5:08 am on Nov 25 2006   

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

How would you do about the users_online to a memberlist? Telling if the user is online or not.


woohoo!
    Viewed: 7,379 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: user online" Posted: @ 5:36 pm on Nov 25 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

ki,
In your users online table, add user id or username. Then, in the users online script, see if the person is logged in. If so, when you add them to the users online table, also add the user id or username.

Then, in your memberlist, as you loop through the members check the users online table to see if their username or user id is in. If so, display "online& quot; if not, "offline. "




-bs0d | AllSyntax.com

    Viewed: 7,369 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: user ionline" Posted: @ 9:04 pm on Nov 25 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

ice done that but the memberlist ive tried so many types of mysql things for the checking it never works, so if you can give me an example




woohoo!

    Viewed: 7,364 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: user online" Posted: @ 3:17 am on Nov 26 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

ok


Code:


$o = mysql_query(&q uot;SELECT `username` FROM `users_online` WHERE `username` = '".$memb erlist_query-&g t;username.&qu ot;'";

//you could do this:
$online = mysql_fetch_obj ect($o);
if($online-> username == $memberlist_que ry->username ) {
echo("onl ine";
} else {
echo("off line";
} //end if

//or you could probably do this:
if($mysql_num_r ows($o) == 0) {
echo("off line";
} else {
echo("onl ine";
} //end if



now this code would go inside a while loop of the memberlist query




-bs0d | AllSyntax.com

    Viewed: 7,354 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: user ionline" Posted: @ 9:01 am on Nov 26 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

that worked perfect thanks




woohoo!

    Viewed: 7,349 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank