Hi,

Is there a way to handle MySQL errors gracefully such as a duplicate entry
into a UNIQUE field, the method I've been using seems a little laborious...

//see if user exists
  $query = "SELECT *
        FROM users
        WHERE Username = '".$_POST[username]."'";
  $result = @mysql_query($query);
  $num = @mysql_num_rows($result);
  if($num > 0){
   $error = "Username already exists, please choose a another one";
   header("Location: add_user.php?error=$error");
   exit;
  }

Thanks for your help

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to