将表格行拆分为列

问题描述:

我有一部分代码从MySQL数据库中提取数字,并使用PHP将其显示到HTML表格中。但是,我从这一行中获得了大量数据,很容易超过100行,并且我想按25个左右的长度分割成若干列。

I have a certain part of code that pulls numbers from a Mysql database and displays it into a HTML table using PHP. However, I have lots of data from this one row, over 100 lines easily, and I would like to split into columns by lengths of 25 or so.

这是目前的代码:

This is the code so far:

 while($row = mysql_fetch_array($results))
{
    echo "<tr>";
    echo "<td>" . $Destination = $row["Destination"] . "</td>";
    echo "</tr>";
}

我应该继续使用表格还是有更好的方法来保持良好的效果格式和拆分?这将用于Web视图,所以我想坚持使用CSS或HTML元素。

Should I continue using a table or is there a better way to keep a nice format and split? This is going to be used for a web view, so I'd like to stick with CSS or HTML elements.

$i = 1;
echo "<tr>";
while($row = mysql_fetch_array($results))
{
    echo "<td>".$row['Destination']."</td>";

    if ($i % 25 == 0) echo "</tr><tr>";

    $i++;
}
echo "</tr>";