i need to find a way to find out what number of a row is in a database... for example: //this is the database Username: Chuck Password: adsasa Username: jimmy Password: adsf Username: stewart Password: dfds the information i need is what row jimmy resides on.. this is what i tried: function i_gun ($user) { global $username; $gun = mysql_query("select * from users"); while ($d = mysql_fetch_array($gun)) { while($d[username] != $user) { $i = $i + 1; } } } but it always returns 1. can sombody tell me what i am doing wrong or point me in the right direction in the manual? plase and thank you