Trapping a mySQL error

From: Date: Thu, 28 Jul 2005 00:13:09 +0000
Subject: Trapping a mySQL error
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-39985@lists.php.net to get a copy of this message
Hi all, I have a table with the record_id as the unique primary key and another column (the record_name) as unique as well. This is working how I want it to. I want unique record_names. When the user tries to add a record with an existing record_name the sql statement execution fails: error 1062. How could I trap this error and display a custom message to handle the situation better? Thanks in advance. John

« previous php.db (#39985) next »