<table border=1>
<?php 
$conn = mysql_connect("localhost","root","");
mysql_select_db("art");
$sql = "select * from art order by id limit 0,10";
$rs = mysql_query($sql);
while($result = mysql_fetch_array($rs))
{
  $title = $result['title'];
?>
<tr>
  <td><?php echo $title;?></td>
</tr>
<?php } ?>
</table>代码是这样的,输出前十条,那么前三条后面加个代表"new"的图片,多谢了,请给个思想或者把上面的代码修改一下也可以

解决方案 »

  1.   

    <table border=1>
    <?php 
    $conn = mysql_connect("localhost","root","");
    mysql_select_db("art");
    $sql = "select * from art order by id limit 0,10";
    $rs = mysql_query($sql);
    $i = 0;
    while($result = mysql_fetch_array($rs))
    {
      $title = $result['title'];
    ?>
    <tr>
      <td><?php if($<3){ echo "新新闻图片...."; } echo $title;?></td>
    </tr>
    <?php $i++; } ?>
    </table>
      

  2.   

    <table border=1>
    <?php 
    $conn = mysql_connect("localhost","root","");
    mysql_select_db("art");
    $sql = "select * from art order by id limit 0,10";
    $rs = mysql_query($sql);
    $i = 0;
    while($result = mysql_fetch_array($rs))
    {
      $title = $result['title'];
    ?>
    <tr>
      <td><?php if($i<3){ echo "新新闻图片...."; } echo $title;?></td>
    </tr>
    <?php $i++; } ?>
    </table>
      

  3.   

    你输出的时候要用循环吧?价格参数判断循环次数,前三次循环加img tag
      

  4.   

    解决了,谢谢genshing(.) 给的思路和修改的代码!