我有这个说法可以正常工作,但按字母顺序从左到右按3列排列。我希望它按字母顺序排列在列的下方,然后继续到下一列。任何人都知道我可以做到这一点。列出3列按字母顺序排列的mysql数据
$models = mysql_query("SELECT model, id FROM model where make='$phonemake' order by model asc") or die(mysql_error());
$count = 0;
$max = 3;
while($model = mysql_fetch_array($models))
{
$count++;
echo "<div style='float:left; width:31%; padding-right:5px;'>".$model['model']." <a href='include/delete-model.php?id=".$model['id']."' onclick='return makesure".$model['id']."();'>Delete</a></div>";
if($count >= $max){
//reset counter
$count = 0;
//end and restart
echo"<div style='clear:both;'></div>";
谢谢v-x我试过并在按字母顺序排列之前得到了相同的结果。 – Breezy 2013-02-28 09:04:19
Johny感谢您的回复,并且您会更详细地解释。谢谢 – Breezy 2013-02-28 09:04:50