View Full Version : See whos Online

Jon W
09-27-2008, 12:57 PM
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');
if(!$con) {
die('Server Error: ' . mysql_error());

mysql_select_db('characters', $con);

$online_players = mysql_query("SELECT FROM characters WHERE online = '1'") or die('Database Error: ' . mysql_error());

$players_online = mysql_num_rows($online);


But whenever I tried that I got the following error:

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
SELECT FROM characters WHERE online = '1'" select WHAT from characters ?