Possible Duplicate:
MySql Row Number?
I'm using PHP 5 and mysqli. I have a table of chapters with columns 'id' and 'name'. Is there a simple and efficient way to query to check what index a specified row is located at? For example, lets say the records in my 'chapters' table are:
id | name
1 | Hello
4 | World
5 | How are you?
And lets say I want to find out where "How are you?" is. The desired result would be index 3 (since it is the third row in the table sorted by id ascending).
The only solution I've come up with is to query for all of them, and then in PHP loop through and find where $row["id"] == 5 and figuring out what iteration it is in the loop. Is there a more efficient way to do this?