Issue
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.
Solution
$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>";
Answered By - Bora
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.