Ad Code

Split table rows into columns

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 5 or so.

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

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

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

 

Post a Comment

0 Comments