Hi Burn, Wednesday, June 6, 2007, 4:39:05 PM, you wrote: > Worst thing that can happen is having mysql throw an error while trying > to insert an ID that's already present in the database. It gets more > complicated and unpredictable if the field isn't required to be unique > at database design level. > Wanting to make it perfectly safe the check should include the INSERT > statement and continue looping till it's successful as well. Or just wrap the whole thing in a stored procedure / transaction (it's what they were invented for after-all :), tasks like this should be pushed to SQL as much as possible imho. Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php