我有这个工作正常的语句,但从左到右按字母顺序列出 3 列。我希望它按字母顺序垂直向下列,然后继续到下一列。任何人都知道我该怎么做。
$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>";