Hi Jon Try using something like
$getlist = mysql_query("SELECT id FROM yourdb",$dbconnectetc); $numrows = mysql_num_rows($getlist); echo "$numrows\n"; This will give you the number of records in your db. If you use autoincrement for the id field your will not have to worry about your ++. If you delete any records numrows will always be correct. HTH Howard -------------------------------------------- First off, sorry for the newbie question... :(. I want to be able to query the database and find the record with the highest ID value. Example... each row ideally has an incremented integer ID (1, 2, 3, 4...) but I am running into problems when I try and delete a row (let's say row 2). My PHP currently selects all of the rows and formulates the ID off of that... This I found out is bad because when I delete row 2 the query says there are 3 rows so my PHP will try to make the ID = 4. I just need the code to find the highest ID so I can ++ it. Sorry again for the easy question! -Jon Gales http://www.macmerc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php