Download to see users online.
Posted: Wed Jan 06, 2010 12:44 am
Hello moderators...this is my first post..I have done a lot of reading but can not find the answer.
I have made a mysql database and would like to be able to see who is online using php.
I have what I think is the right script but get a white screen, so apparently there is a mistake in it somewhere.
I am a newbie to php...and need assistance please.
The database has a field active users, and I know my config file is okay, everything else...register, login etc work perfectly
The offending script is here.
Can you please find the fault.
Thanks in advance
aussieincanada
I have made a mysql database and would like to be able to see who is online using php.
I have what I think is the right script but get a white screen, so apparently there is a mistake in it somewhere.
I am a newbie to php...and need assistance please.
The database has a field active users, and I know my config file is okay, everything else...register, login etc work perfectly
The offending script is here.
Code: Select all
<?php
session_start();
include('config.php');
$conn = mysql_connect($server,$dbusername,$dbpassword)or die (mysql_error());
$db = mysql_select_db($db_name,$conn) or die (mysql_error());
$sql = "SELECT * FROM active_users";
$result = mysql_query($sql,$conn);
while($sql = mysql_fetch_object($result)){
$_uname = $sql -> username;
echo $_uname;
echo "<br>";
}
?>
Thanks in advance
aussieincanada