[PHP/MySQL] getting last row from database

hi all. i’ve been absent from the Kirupa forums for so long that i don’t even know my old username and password. i came back to answer all the questions that i can, and hopefully to get some answers of my own.

my problem is as follows… i will oversimplify both the code and the description in the interests of clarity.

i have, for example, 10 rows in a database. the database table i’m accessing has two fields. one is an ID set to AUTO_INCREMENT. the other is just a text field that contains some data, in this case, a song title.

what i want to do is echo out the first 9 rows in a certain way, and then have the last row echo out in another way. basically i want to put two line breaks (<br />
<br />) after the first nine results, but not after the tenth result.

to make things more difficult, the code can’t include anything that statically refers to the current number of rows in the database. the website is for a friend’s band, and they’ll be able to log into a content management system to add information to the website. for example, if there are 10 songs in the database, and they add another, the AUTO_INCREMENT value will increase by one. it’s not really going to work out if i have to go back and change the code whenever they add new songs, so an ideal function would use some sort of variable that dynamically refers to the number of rows in the database. for example, using:

[font=Courier New]$number_of_songs = mysql_num_rows($result)[/font]

i’ve spent many hours today trying to solve this problem - it pretty much derailed my momentum and i have to admit that i’m stuck. anybody want to write a nice, elegant loop that will take care of this issue?