I'm trying to do something like this:
ONLINE USERS
xbase, bitty, jex, jeff
I want the last name to not have a , after it, but i'm having issues with my coding:
<b>ONLINE USERS - </b><br>
---------------------------------<br>
<?
$sql = "SELECT * FROM online_users";
$result = mysql_query($sql);
$numofonlinerows = mysql_num_rows($result);
for($online_total = 0; $online_total < $numofonlinerows; $online_total++) {
$row = mysql_fetch_array($result); //get a row from our result set
$online_userid = $row['userid'];
$sql2 = "SELECT * FROM users WHERE userid = $online_userid";
$query2= mysql_query($sql2);
$arr2 = mysql_Fetch_Array($query2);
$online_username = $arr2['username'];
if(($online_total % '*')=='*') { //this means if there is a remainder
echo "$online_username";
} else { //if there isn't a remainder we will do the else
echo "$online_username, ";
}
}
?>
If anyone can help me out, I would greatly appreciate it.