Error Control

From: Date: Mon, 26 Mar 2001 03:49:56 +0000
Subject: Error Control
Groups: php.db 
Request: Send a blank email to php-db+get-7789@lists.php.net to get a copy of this message
Hello! I'm writing a script that validates a form.... It creates users in a mysql table, where there are 2 unique columns 'username' and 'email'. I'm putting mysql_error() into a variable, but I don't want the end user to see that particular message... is there a way to look at just the key that has been duplicated, and create a custom error message for user display? for example, when I duplicate a username, 'jbell', I get this from mysql_error() : "Duplicate entry 'jbell' for key 2" I want to be able to see that the error is from key 2, and react accordingly.... thank you, Jason Bell

« previous php.db (#7789) next »