leeboycymru
Programmer
I have a piece of code that pulls out data from a databse and I want it to align horizontally until it reaches end of table and then it simply wraps around to start a new line.
The code im using is using a new UL and LI for each indivudual data, and seems very wasteful to me.
Can anybody help trim this code so that all it does is pull the data out and lets it run until its finished running horizontally but forming a vertical column due to width constraints.
Take a look at the link below, its the yellow output after 'Tour Operators':
<?php
$cnt = 0;
echo "<td>";
while($cnt < $top_count) {
$qw=mysql_query("select * from tbl_touroperators where Nom_Top = '$top_array[$cnt]'") or die (mysql_error());
$rw=mysql_fetch_assoc($qw);
echo "<ul class='navlist'>";
echo "<li class=\"middletext\"><a href=\" . $rw[Web_Top] . "\" class=\"bigweblinks\">" . $top_array[$cnt] . "</a></li>\n";
echo ($cnt % 1 === 0 || $cnt === $top_count - 1) ? "</ul>\n" : "";
$cnt = $cnt+1;
}
echo "</td>";
?>
And here is the link:
Cheers
Lee
The code im using is using a new UL and LI for each indivudual data, and seems very wasteful to me.
Can anybody help trim this code so that all it does is pull the data out and lets it run until its finished running horizontally but forming a vertical column due to width constraints.
Take a look at the link below, its the yellow output after 'Tour Operators':
<?php
$cnt = 0;
echo "<td>";
while($cnt < $top_count) {
$qw=mysql_query("select * from tbl_touroperators where Nom_Top = '$top_array[$cnt]'") or die (mysql_error());
$rw=mysql_fetch_assoc($qw);
echo "<ul class='navlist'>";
echo "<li class=\"middletext\"><a href=\" . $rw[Web_Top] . "\" class=\"bigweblinks\">" . $top_array[$cnt] . "</a></li>\n";
echo ($cnt % 1 === 0 || $cnt === $top_count - 1) ? "</ul>\n" : "";
$cnt = $cnt+1;
}
echo "</td>";
?>
And here is the link:
Cheers
Lee