$sql = mysql_query("SELECT * FROM ".TBL_ACTIVE_USERS."
WHERE faction=$userfaction_id ORDER BY timestamp DESC,username");
$numrows = mysql_numrows($sql);
if($numrows == 1){ echo 'You are the only faction member online'; }
else{
while($online = mysql_fetch_array($sql)){
echo '<a href="#" class="light_grey">'.$online['username'].'</a>';
echo ', ';
}
}
The code above works fine if only one member is connected to the network. The problem is really aesthetic.
If several users are online, the request displays:
Administrator, system,
I was wondering how I would do it like this on the last result (last member online by while () {} clause) Could I remove the comma? Is there a way to limit the while statement to $ numrows-1 or something in that direction? Then repeat the last user without a comma and a space after their name?
source
share