PDA

View Full Version : User System-Help



gbt91
06-04-2007, 06:56 PM
I was Testing this User System and i was trying to add the online users but without success, i made the total user script and it works great but for the online nothing..could someone plz help me??


<?php
ob_start();
include("config.php");
$table = 'usersystem';//Sets the table name
$totalusers = mysql_num_rows(mysql_query("SELECT id FROM $table"));
echo "<br /><font size='1' face='Verdana'><b>Utenti Totali:</b> $totalusers</font><br />";// Echoes the total users
?>
this is for the total user online
if u need else to help me,just ask...
thanks in advance for helping me out
It's Based od Techtuts System

Drompo
06-04-2007, 07:20 PM
i would have thoguht the table name would have been something along the lines of
users_online

the database would be called usersystem

<?php
ob_start();
include("config.php");
$table = 'users_online'; //Sets the table name
$query = mysql_query("SELECT * FROM $table") or die("ERROR: ".mysql_error());
$num = mysql_num_rows($query);
echo "<br /><font size='1' face='Verdana'><b>Utenti Totali:</b> $num</font><br />";// Echoes the total users
?>

gbt91
06-04-2007, 07:27 PM
Nice ++++
And to get thier Username???

gbt91
06-04-2007, 08:00 PM
Ooppsss.
trying this code i found out that it shows the total users not the current online users :S:@

Drompo
06-04-2007, 08:20 PM
<?php
ob_start();
include("config.php");
$table = 'users_online'; //Sets the table name
$view = mysql_query("SELECT * FROM $table") or die ("Error!");
echo("");
$checkview = mysql_num_rows($view);
while($getview = mysql_fetch_array($view))
{
echo "<br /><font size='1' face='Verdana'><b>Utenti Totali:</b>{$getuser['username']}&nbsp;</font><br />";
}
?>
That will display all the users that are online with their usernames

Want to hide these adverts? Register an account for free!