Creating a top ten list of bands using dreamweaver cs3
Posted: Sat May 09, 2009 4:51 pm
Hi guys,
I've been searching for the last 2 hours online to find a way to make a top ten list in PHP drawing some of the data from a database
basically i'm working on a site which will display the top 10 voted bands drawing the band name and the rating from the DB. however with the repeat region I'm having trouble with one coloumn of the table showing the numbers 1-10 even though its within the repeat reagion, this is what i have so far fot the table:
Which shows:
# | band_rating | band_name
12345678910 | 0 | beirons band
12345678910 | 0 | band 2
what i want it to show is
# | band_rating | band_name
1 | 3 | beirons band
2 | 2 | band 2
I have done this before on a previous site but have lost the code.
can anyone help? thanks
I've been searching for the last 2 hours online to find a way to make a top ten list in PHP drawing some of the data from a database
basically i'm working on a site which will display the top 10 voted bands drawing the band name and the rating from the DB. however with the repeat region I'm having trouble with one coloumn of the table showing the numbers 1-10 even though its within the repeat reagion, this is what i have so far fot the table:
Code: Select all
<table border="1" align="center">
<tr>
<td>#</td>
<td>band_rating</td>
<td>band_name</td>
</tr>
<?php do { ?>
<tr>
<td>
<?php
$i = 1;
for($i; $i<10; $i++)
{
echo $i;
}
?>
</td>
<td><?php echo $row_topten['band_rating']; ?> </td>
<td><a href="profile.php?band_name=<?php echo $row_topten['band_name']; ?>"> <?php echo $row_topten['band_name']; ?> </a> </td>
</tr>
<?php } while ($row_topten = mysql_fetch_assoc($topten)); ?>
</table>
# | band_rating | band_name
12345678910 | 0 | beirons band
12345678910 | 0 | band 2
what i want it to show is
# | band_rating | band_name
1 | 3 | beirons band
2 | 2 | band 2
I have done this before on a previous site but have lost the code.
can anyone help? thanks