Code: Select all
<?php
/*
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
*/
$slash = "/";
include("header.php");
include("chatroom".$slash."config.php");
include("chatroom".$slash."chat_themes".$slash."default_theme.php");
$link = mysql_connect($server, $user, $password);
mysql_select_db($database, $link);
echo "<table border="2"><tr><td width="75%">Chatroom</td><td>Users in Room</td></tr>";
$result = mysql_query("SELECT * FROM `".$prefix."chat_rooms`") or die("Room query failed");
while ($row = mysql_fetch_row($result))
{
$rooms[] = $row;
}
mysql_free_result($result);
if ($rooms != "")
{
foreach ($rooms as $room)
{
$roomid = $room[0];
$i = 1;
echo "<tr><td><b/><a href="chatroom/aatachat.php?roomid=".$room[0]."&name=".$room[1]."" target="_blank">".$room[0]." - ".$room[1]."</b></a><br/>$room[2]</td>";
echo "<td>";
$sql = "SELECT * FROM `".$prefix."chat_users` WHERE `room_active_".$roomid."` = '1'";
$userresult = "";
$userresult = mysql_query($sql) or die("User query failed");
while ($row = mysql_fetch_row($userresult))
{
$users[] = $row;
}
$usernum = mysql_num_rows($userresult);
mysql_free_result($userresult);
if ($users != "")
{
foreach ($users as $user)
{
$username = $user[0];
if ($usernum == 1)
{
echo $username;
}
else
{
if ($i < $usernum)
{
echo $username.", ";
}
elseif ($i == $usernum)
{
echo $username;
}
}
$i++;
}
}
else
{
echo "No users in Room";
}
echo "</td></tr>";
}
}
else
{
echo "No Chat Rooms available";
}
include("footer.php");
?>As you can see, everything is working fine, but for some reason its outputting the names of the previous tables with it. Any cluesTable number - Table name Doom, Doomer, Doomie
Table description
------------------------------
Table2 number - Table2 name DoomDoomerDoomieDoomier
Table2 description
Along with this, I would like to ask something. For the mysql queries, I do this:
Code: Select all
<?php
$username = $user[0];
?>Code: Select all
<?php
$username = $user['user'];
?>Doom out...