Question: 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>";
}

```

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.

Answer: 
Try this:

```
<?php
$i = 1;
$columns = 25;
while($row = mysql_fetch_array($results))
{
    if($i == 1){ echo '<tr>'; }
    echo "<td>" . $Destination = $row["Destination"] . "</td>";
    $i++;
    if($i == ($columns + 1)) { echo '</tr>'; $i = 1; }
}
?>

```
You can use this:

```
<table>
          <?php
           $mysqli = new mysqli('localhost', 'root', '', 'crud') or die(mysqli_error($mysqli)); 
           $result = $mysqli->query("SELECT * FROM data") or die(mysqli->error);

          $i = 1;
          $columns = 3;
          echo "<tr>";
          while($row = $result->fetch_assoc())
          {
            if($i == 1){ echo '<tr>'; }
            echo "<td>" . $Destination = $row["name"] . "</td>";
            $i++;
            if($i == ($columns + 1)) { echo '</tr>'; $i = 1; }
          }
          echo "</tr>";
          ?></table>

```