Okay, the following code is for a type of chat room in which, either messages that are less than 15 minutes old, or the most recent 25 messages will be printed. However, all that is being printed is the HTML tag and the Backround tag, which are not in the PHP coding. And, yes, I do have a message in the Database that should be printed, but is not. Can anyone offer any help?
Code:
<html>
<body background="tschat.png" properties="fixed">
<?php
mysql_connect("localhost", "chat", "password") or die(mysql_error());
mysql_select_db("chat") or die(mysql_error());
$time = date("U");
$display = $time-900;
$entries = mysql_query("SELECT COUNT FROM messages WHERE date >= $display");
$result = mysql_query("SELECT * FROM messages WHERE date >= $display") or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
if ($entries > '25'){
for ($i='1'; $i<='25'; $i++){
echo "<table width='600' border='1' cellspacing='0' cellpadding='1' bordercolor='white'>";
echo "<tr>";
echo "<td width='150'>";
echo $row['date'];
echo "</td>";
echo "<td width='406'>";
$result2 = mysql_query("SELECT * FROM users WHERE username='$row[username]'") or die(mysql_error());
while($row2 = mysql_fetch_array( $result2 )){
echo $row2['handle'];
}
echo "</td>";
echo "<td rowspan='2' height='44' width='44'>";
$result2 = mysql_query("SELECT * FROM users WHERE username='$row[username]'") or die(mysql_error());
while($row2 = mysql_fetch_array( $result2 )) {
echo "<img src='";
echo $row2['av'];
echo "\'>";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' width='556'>";
echo "Info";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='3' width='600'>";
echo $row['message'];
echo "<br>";
echo "</td>";
echo "</tr>";
echo "</table><br><br> ";
echo "</body>";
echo "</html>";
}
}
elseif ($entries <= '25'){
for ($i='1'; $i<=$entries; $i++){
echo "<table width='600' border='1' cellspacing='0' cellpadding='1' bordercolor='white'>";
echo "<tr>";
echo "<td width='150'>";
echo $row['date'];
echo "</td>";
echo "<td width='406'>";
$result2 = mysql_query("SELECT * FROM users WHERE username='$row[username]'") or die(mysql_error());
while($row2 = mysql_fetch_array( $result2 )){
echo $row2['handle'];
}
echo "</td>";
echo "<td rowspan='2' height='44' width='44'>";
$result2 = mysql_query("SELECT * FROM users WHERE username='$row[username]'") or die(mysql_error());
while($row2 = mysql_fetch_array( $result2 )) {
echo "<img src='";
echo $row2['av'];
echo "\'>";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='2' width='556'>";
echo "Info";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='3' width='600'>";
echo $row['message'];
echo "<br>";
echo "</td>";
echo "</tr>";
echo "</table><br><br> ";
echo "</body>";
echo "</html>";
}
}
else{
}
}
?>