$result = mysql_query("select * from yht order by id desc");
echo "<table width='97%' border='0' cellpadding='0' cellspacing='1'>";
$nums = mysql_num_rows($result);
$lines = ceil($nums/3);
for($li=1;$li<=$lines;$li++){
$row = mysql_fetch_array($result);
$offset = $li*3;
@mysql_data_seek($result,$offset);
echo "<tr>";
for($i=1;$i<=3;$i++)
{
echo "<td>";
echo "<img src='img/$rowp[img_name]' width='141'>";
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
echo "<table width='97%' border='0' cellpadding='0' cellspacing='1'>";
$nums = mysql_num_rows($result);
$lines = ceil($nums/3);
for($li=1;$li<=$lines;$li++){
$row = mysql_fetch_array($result);
$offset = $li*3;
@mysql_data_seek($result,$offset);
echo "<tr>";
for($i=1;$i<=3;$i++)
{
echo "<td>";
echo "<img src='img/$rowp[img_name]' width='141'>";
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
A|A|A
A|A|A
B|B|B
B|B|B
B|B|B跟我要实现的
A|B|C|D
E|F|G|H
还有一定偏差,你水平比我高的多,请再赐教!谢谢
echo "<table width='97%' border='0' cellpadding='0' cellspacing='1'>";
$nums = mysql_num_rows($result);
$lines = ceil($nums/3);
for($li=1;$li<=$lines;$li++){echo "<tr>";
for($i=1;$i<=3;$i++)
{$row = mysql_fetch_array($result);
echo "<td>";
echo "<img src='img/$rowp[img_name]' width='141'>";
echo "</td>";
}
echo "</tr>";
}
echo "</table>";==============================================
这样应该可以了!是你要的么?加分吧!