<? //新闻类别 $query_cat="select * from $dbtable1"; $result_cat=mysql_query($query_cat) or die("<mce:script type="text/javascript"><!-- alert('提示:查寻新闻类别失败,请跟管理员联系') // --></mce:script>"); if(!$result_cat) { echo "没有类别"; } else { while($row_cat=mysql_fetch_array($result_cat)) { echo "<table width='100%' border='0' cellspacing='1' cellpadding='1' bgcolor=#000000>"; echo "<tr>"; echo "<td bgcolor=#F1DAB1>"; echo" == $row_cat[title] ==</td></tr>"; echo "<tr><td bgcolor=#fef7ed>"; //本类别新闻标题 $query_news="select id,title,addtime from $dbtable2 where cateid='$row_cat[id]' order by addtime desc"; $result_news=mysql_query($query_news) or die("<mce:script type="text/javascript"><!-- alert('提示:查寻新闻标题失败,请跟管理员联系') // --></mce:script>"); if ($result_news) { echo "<ul>"; while ($row_news=mysql_fetch_array($result_news)) { echo "<li><a targer='_self' href="/" mce_href="/""shownews.php?id=$row_news[id]/">$row_news[title](".DateTime("Y-m-d "."H:i",$row_news['addtime']).")</a>"; } echo"</ul>"; echo"<p align=right>"; echo"<a target='_self' href="/" mce_href="/""category.php?cate=$row_cat[id]/">更多新闻..</a></p>"; echo "</td></tr></table>"; } else { echo "没有新闻"; echo "</td></tr></table>"; } } } ?> http://topic.csdn.net/t/20020830/10/982199.html#