View Single Post
  #6  
Old 03-27-2012, 04:47 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 82,652
SilverDragonTears is on a distinguished road
Default

Pardon me for being ignorant... where do I put this and what do I put in the ('...')

Quote:
Originally Posted by fadillzzz View Post
Assuming you have a unique index on the name field, this can be achieved without any additional query.

PHP Code:
$stmt $adopts->query('...');
if ( ! 
$stmt)
{
    
// failed, the name is already in use
}
else
{
    
// successfully renamed

I think this would be a much better solution, because not only that you keep the MySQL from choking, but you also keep your code succinct.
__________________

Check out SilvaTales
Reply With Quote