我无法弄清楚这一点,也不是我编码以太的强项。
截至目前,它只会打印第一人称和时间戳,而不是更多。
<table cellpadding="0" cellspacing="0" width="100%">
<tr><td></td></tr>
<?php
include '../connection.php';
$sql = "SELECT *
FROM messagebox
INNER JOIN person
ON messagebox.sid = person.sid
ORDER BY messagebox.id DESC
LIMIT 20
";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
if ($switch=='1')
{
echo "<tr bgcolor=\"#FFFFFF\">";
$switch='0';
}
else
{
echo "<tr bgcolor=\"#F9F9F9\">";
$switch='1';
}
$elfstring = utf8_encode($row['shout']);
function smiley($elfstring) {
$elfstring = ereg_replace(":)","<img src=!.png alt=\"!\" >", $elfstring);
$elfstring = ereg_replace(":(","<img src=laugh.gif alt=\":D\" >", $elfstring);
$elfstring = ereg_replace(":p","<img src=tongue.gif alt=\":p\" >", $elfstring);
return $elfstrings;
}
$messages = smiley($elfstring);
echo "";
echo "<td width=\"100\" valign=\"top\"><strong>" . $row['name'] . "</strong></td>";
echo "<td width=\"100\" valign=\"top\">" . "(" . $row['place'] .")</td>";
echo "<td width=\"70\" valign=\"top\">" . "" . date('H:i:s',strtotime ($row['timestamp'])) ."</td>";
echo "<td valign=\"top\">" . smiley($elfstrings) . "</td>";
echo "</tr>";
}
?>
<tr>
<td>
</td>
</tr>
</table>
我知道这段代码的某些部分已被弃用,但使用它的服务器很旧并且不是最新的。
提前感谢您的帮助。