View Single Post
  #3  
Old 03-27-2012, 03:13 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,964
fadillzzz is an unknown quantity at this point
Default

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.

Last edited by fadillzzz; 03-27-2012 at 03:15 AM.
Reply With Quote