I run an online game with php and mysql, and users want their current rank on the account page...
now to do that, I order the results and do a bunch of
mysql_fetch_array($result)
until i find their id. this seems like a HUGE cpu hogging way to do this.
is there a way to do the query with ordered results, and then get the row number for a certain user?
i actually have another question, i was just going to dump the results in a new table that would have an auto_increment rank field, and then just delete all rows from that table, and rank the users every 15 minutes... the problem is, even if the table is completely cleared, the auto_increment never goes back to 0!
any help would be GREAT!
now to do that, I order the results and do a bunch of
mysql_fetch_array($result)
until i find their id. this seems like a HUGE cpu hogging way to do this.
is there a way to do the query with ordered results, and then get the row number for a certain user?
i actually have another question, i was just going to dump the results in a new table that would have an auto_increment rank field, and then just delete all rows from that table, and rank the users every 15 minutes... the problem is, even if the table is completely cleared, the auto_increment never goes back to 0!
any help would be GREAT!