Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: See whos Online
09-27-2008, 12:57 PM #1
- Join Date
- Jan 2008
- Thanked 0 Times in 0 Posts
See whos Online
Hello, I'm back yet again with another question. Since you guys was so helpful the last time I figure you guys could probably help this time. Its simple really what I'm doing, but I can't seem to figure out why my problem is with this. Ok so the goal here is to make a script to check and see whos online. How that works is in the database whenever someone logs in the column in the database turns from 0 to 1, which means that they are online. The problem here that I'm having is making a script that whenever it turns to 1 it will add to up and up. For example, one player was online and then another person logged it and that would make it two. I thought at first this should be fairly simple, which shortly after messing around with this realizeing how bad my knowledge really is in PHP. So this is what I tried.
$con = mysql_connect('localhost','username','password');
die('Server Error: ' . mysql_error());
$online_players = mysql_query("SELECT FROM characters WHERE online = '1'") or die('Database Error: ' . mysql_error());
$players_online = mysql_num_rows($online);
Server Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM characters WHERE online ='1'' at line 1
09-27-2008, 01:27 PM #2
SELECT FROM characters WHERE online = '1'"
- Join Date
- Mar 2007
- Thanked 2,248 Times in 2,235 Posts
WHATfrom characters ?The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)