cecov74
09-08-2003, 04:04 PM
What is the query to know hos is on-line?
cecov74
09-09-2003, 07:36 AM
I have do
<?
include ('config2.inc.php');
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
$query = "SELECT access.userid, access.forumid, access.accessmask, user.userid, user.username FROM access, user
WHERE access.userid = user.userid
AND access.accessmask != 0
ORDER BY user.username";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_array($result))
{ echo "<font face=Tahoma size=2>" . $row[username] . " , </font>"; }
mysql_close($db);
?>
but I see the name of member 2/3/4 time
"Antonio, Antonio, Antonio, BILL, FREDD, FREDD, ecc..."
I want see only ther first record, If there is the same don't do a print :(
Issvar
09-13-2003, 06:55 PM
$query='SELECT DISTINCT session.userid,user.username FROM session LEFT JOIN user ON user.userid=session.userid WHERE user.invisible=0 AND session.userid>0 AND ('.time().'-session.lastactivity-1500)<0 ORDER BY user.username';
The 1500 is the timeoutvalue of your cookies, you should set this to match your board setting (or get it from the option table in a seperate query).
Access table has nothing to do with who is online.
When you have more than one table in your query use JOIN to join them or you might get too many results back.
Use distinct keyword to only get unique results.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.