Page 1 of 1

Trying to query a list of online users.

Posted: Sat Mar 19, 2011 11:46 pm
by aIexi
Hello,

I'm creating a game, and I want to show a list of players who have done something to update the timestamp in the past 3 minutes. On every button they click, a time stamp is updated.

Now I want to echo out the page, but my query seems to be wrong. I'm not sure how often it updates, or what it's doing, but it doesn't seem to be working properly.

Code: Select all


$queryu="SELECT * FROM users WHERE lastonline >= DATE_SUB(CURDATE(), INTERVAL 3 MINUTE)";

Can anyone give me any advice on how to correct this?

Thanks,

Alexi

Re: Trying to query a list of online users.

Posted: Sun Mar 20, 2011 12:25 am
by fugix
I assume that you are puting this into the mysql_query() function right?

Re: Trying to query a list of online users.

Posted: Sun Mar 20, 2011 11:25 am
by social_experiment
An easy way of troubleshooting is to use the following code while you are still in the developing phase/s

Code: Select all

$sql = mysql_query($your_query) or die(mysql_error());
If there is a problem with $your_query it will immediatly show up and you can fix the problem.
aIexi wrote:...but it doesn't seem to be working properly.
Are you receiving any errors, warnings? Be more specific about the problem.
Hth