php从数据库选取记录形成列表(首页调用)

        	<ul class="e1">
<?php
	$querySel = "select ID,Tit,Addtime from news where DShow = 1 and ClassID=1 order by Addtime desc limit 0,6";
	$result_sub = mysql_query($querySel) or die(mysql_error()); 
	while($row_sub=mysql_fetch_array($result_sub)) 
	{
?>
  				<li><a href="NewsInfo.php?id=<?php echo $row_sub['ID'] ?>" target="_blank" class="tmain"><?php echo cut_str($row_sub['Tit'],14,0) ?></a><span><?php echo date('m-d', strtotime($row_sub['Addtime'])); ?></span></li>
<?php
}
?>
            </ul>

  

posted @ 2013-12-18 10:34  山貓  阅读(303)  评论(0编辑  收藏  举报