When a new user logs into my site, I add the user id and pswd to my auth table. If the user id is already there, I'd like to display an error rather than the error created by PHP. Is there a graceful way of doing this? I think I probably need to take out the or die from the insert statement and handle the error through mysql_errorno, but how? Do I write a function that looks specifically for the error number?
Thanks in advance for any advice on this!!
$sql = "INSERT INTO auth values ('$userid', password('$password'))";
$result = mysql_query($sql) or die ('Error: ' . mysql_error() . '<br>Query: ' . $sql);