$query = $db->query("SELECT * FROM $table_products ORDER BY posttime DESC LIMIT 0,10");
$newproductlist = array();
$bgcolor=ALTBG1;
$newproductnum=0;
echo "<table width=14% border=1>";
while($dbq_rec = $db->fetch_array($query))
{
if ($bgcolor==ALTBG1)
   $bgcolor=ALTBG2;
   elseif($bgcolor==ALTBG2)
   $bgcolor=ALTBG1;
   $dbq_rec['bgcolor']=$bgcolor;
   $dbq_rec['img']=empty($dbq_rec['smallimg'])?IMGDIR.'/noimg.gif':$dbq_rec['smallimg'];
   $dbq_rec['notes']=substr($dbq_rec['notes'] , 0, 35) . " ...";
   $dbq_rec['save']=$dbq_rec['etprice'] - $dbq_rec['ourprice'];
   $dbq_rec['save']=number_format($dbq_rec['save'], 2);
   $dbq_rec['postdate']=gmdate($dateformat,$dbq_rec['posttime']);
   $newproductlist[]=$dbq_rec;
     $newproductnum=$newproductnum+1;  echo "<tr bgcolor=$bgcolor><td colspan=2>pic</td><td colspan=2>name</td><td width=29%>notes</td><td width=71%>viewlink</td></tr>";
}
echo "</table>";

解决方案 »

  1.   

    放到table里的一行就可以了啊
      

  2.   

    倒!!
    picnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlink
    这样子怎么可以呢?
    我要的是我说的那个呀!!
      

  3.   

    echo "<table width=14% border=1>
      <tr> 
        <td colspan=2>pic</td>
      </tr>
      <tr> 
        <td colspan=2>name</td>
      </tr>
      <tr> 
        <td width=29%>notes</td>
        <td width=71%>viewlink</td>
      </tr>
    </table>";
    }
    一个个的横着循环出来
      

  4.   

    pic name notes viewlink 
    pic name notes viewlink 
    pic name notes viewlink 
    pic name notes viewlink 
    pic name notes viewlink 
    pic name notes viewlink 
    pic name notes viewlink 
    这种效果不是我要的呀
      

  5.   

    $query = $db->query("SELECT * FROM $table_products ORDER BY posttime DESC LIMIT 0,10");
    $newproductlist = array();
    $bgcolor=ALTBG1;
    $newproductnum=0;
    echo "<table width=14% border=1><tr>";
    while($dbq_rec = $db->fetch_array($query))
    {
    if ($bgcolor==ALTBG1)
       $bgcolor=ALTBG2;
       elseif($bgcolor==ALTBG2)
       $bgcolor=ALTBG1;
       $dbq_rec['bgcolor']=$bgcolor;
       $dbq_rec['img']=empty($dbq_rec['smallimg'])?IMGDIR.'/noimg.gif':$dbq_rec['smallimg'];
       $dbq_rec['notes']=substr($dbq_rec['notes'] , 0, 35) . " ...";
       $dbq_rec['save']=$dbq_rec['etprice'] - $dbq_rec['ourprice'];
       $dbq_rec['save']=number_format($dbq_rec['save'], 2);
       $dbq_rec['postdate']=gmdate($dateformat,$dbq_rec['posttime']);
       $newproductlist[]=$dbq_rec;
         $newproductnum=$newproductnum+1;
    echo "<td><table width=14% border=1>
      <tr> 
        <td colspan=2>pic</td>
      </tr>
      <tr> 
        <td colspan=2>name</td>
      </tr>
      <tr> 
        <td width=29%>notes</td>
        <td width=71%>viewlink</td>
      </tr>
    </table></td>";
    }
    echo "</tr></table>";
      

  6.   

    有QQ吗?我加你,一旦有问题在csdn请教你