Google failed me, so I seek expert-help :)
Let's say I have a database consisting of "ID" and "Name". Currently in this database I have these records:
001 - John
002 - Eric
003 - Kathy
To generate the next ID i used COUNT in mysql and plussed 1 in php, but I obviously didn't take in account that users can be deleted. If 002 - Eric is deleted, the script will try to use the ID 003, which already exists.
Any way to check this? I figured a while loop that goes through the values, but if the database is long, this would probably take too much resources (and I'm not sure what to loop through)?
As of now, I have this:
SELECT COUNT(id) FROM users
$id = $thecount + 1;