我从数据库读出数据如何按四列显示,就像下面这个连接这样,还有PHP连接mysql怎样才是标准呢我看书这样写 MySQL_query(),网上有的这样写mysql_query(),那种才是标准呢http://www.360buy.com/products/670,671,672,0,0,0,0,0,0,0,1,1,1.html
我从数据库读出数据如何按四列显示,就像下面这个连接这样,还有PHP连接mysql怎样才是标准呢我看书这样写 MySQL_query(),网上有的这样写mysql_query(),那种才是标准呢http://www.360buy.com/products/670,671,672,0,0,0,0,0,0,0,1,1,1.html
你这个哪种都可以的
好如何按4列显显示呢如http://www.360buy.com/products/670,671,672,0,0,0,0,0,0,0,1,1,1.html
$sql1=mysql_query("select count(*) from product a,bigclass b where a.ClassID=b.ClassID and a.isEng=0 and b.type='product' $Classtext $Protext order by a.OnTop desc,a.ID desc");
$arratpro=mysql_fetch_array($sql1);
$pro=$arratpro[0];
if($pro==0)echo "<span class='word13kong' align=center>产品暂时为空!</span>";
else{
$sql=mysql_query("select a.* from product a,bigclass b where a.ClassID=b.ClassID and a.isEng=0 and b.type='product' $Classtext $Protext order by a.OnTop desc,a.ID desc limit 6");
//表格头
echo "<table width=100% border=0 align=center cellpadding=0 cellspacing=0 class=word12bk>";
$count=1;
while($arratpro=mysql_fetch_array($sql)){
if($arratpro[img]=="")$src="imagesp/nopic.gif";
else $src=$arratpro[img];
if($count%3==1)
echo "<tr><td width=33% align=center><a href='product.php?ID=$arratpro[ID]' class='link12b-cx' target='_blank'><img src=$src width=127 height=93 border=0 /><br>$arratpro[Title]</a></td>";
elseif($count%3==2)
echo "<td width=33% align=center><a href='product.php?ID=$arratpro[ID]' class='link12b-cx' target='_blank'><img src=$src width=127 height=93 border=0 /><br>$arratpro[Title]</a></td>";
elseif($count%3==0)
echo "<td width=33% align=center><a href='product.php?ID=$arratpro[ID]' class='link12b-cx' target='_blank'><img src=$src width=127 height=93 border=0 /><br>$arratpro[Title]</a></td></tr>";
$count=$count+1;
}
//表格尾
echo " </table>";
}
?>