I seem to be having troubles bringing the data to the screen in the loop..
$sql = "SELECT * FROM chattable ORDER BY id DESC LIMIT 10";
$result = mysql_query($sql);
echo "<div style=\"width: 300px; height: 200px; overflow: auto;\">";
echo "<table>";
$data = array();
while($data[] = mysql_fetch_assoc($result))
{
echo "<tr><td align=\"left\">";
echo "<span style=\"font-weight: bold; color: red;\">" . $data[1] . ":</span> ";
echo $data[2];
echo "</td></tr>";
}
array_pop($data); //remove last entry cause it's waste
$data = array_reverse($data); //reverse the 10 entries
echo "</table>";
echo "</div>";
doing that, it displays this:
:
Array:
Array: Array
Array: Array
Array: Array
Array: Array
Array: Array
Array: Array
Array: Array
Array: Array