$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>";
$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>";
picnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlinkpicnamenotesviewlink
这样子怎么可以呢?
我要的是我说的那个呀!!
<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>";
}
一个个的横着循环出来
pic name notes viewlink
pic name notes viewlink
pic name notes viewlink
pic name notes viewlink
pic name notes viewlink
pic name notes viewlink
这种效果不是我要的呀
$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>";