我有意見顯示的代碼,但它顯示的所有意見不只是那些都是平等的,不明白這一點。爲什麼這段代碼顯示所有評論?
<?php
$sql = "SELECT * FROM contactnotes,contacts WHERE contactnotes.contacts_id = contacts.ID ORDER BY contactnotes.timestamp DESC" or die('Error: ' .mysql_error());
$result = mysql_query($sql) or die ('Error: ' .mysql_error());
while ($row = mysql_fetch_array($result)){
?>
<table width="950" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left" width="100%"><h5><strong><? echo $row['agentassigned']; ?> on <? echo date("F d Y @ h:i:s", strtotime($row['timestamp'])); ?> wrote:</strong></h5></td>
</tr>
<tr>
<br /><td align="left" width="100%"><? echo $row['notes']; ?></td>
</tr>
</table>
<hr/>
<br />
等於什麼?沒有where子句。 – Jacob
您是否激活了short_tag語法(<?而不是<?php)? –
'WHERE contactnotes.contacts_id = contacts.ID' – joshua76