Hi i've just started learning php and want to do something quite simple but just havent been able to get it to work.
currently i loop out the results of a mysql query into a list, the code is as follows:
<ul class="homelist">
<?php
$years = @mysql_query('SELECT DISTINCT releaseyear FROM film order by 1');
if (!$years) {
exit('<p>Error retrieving years from database!<br />' .
'Error: ' . mysql_error() . '</p>');
}
while ($year = mysql_fetch_array($years)) {
$id = $year['releaseyear'];
echo "<li>Films Released in $id</li>";
}
?>
</ul>
what i would like to do instead is loop out the results into a table that is 5 columns wide as the list of years in the database is getting pretty long and this type of data would be more suited to a table imo.
I did a quick google search but nothing helpful came up, thought you guys could help.
Question
piehouserat
Hi i've just started learning php and want to do something quite simple but just havent been able to get it to work.
currently i loop out the results of a mysql query into a list, the code is as follows:
what i would like to do instead is loop out the results into a table that is 5 columns wide as the list of years in the database is getting pretty long and this type of data would be more suited to a table imo.
I did a quick google search but nothing helpful came up, thought you guys could help.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts