I have a PHP form which enters data into my MySQL database. My primary key is one of the user-entered values. When the user enters a value that already exists in the table,
With mysql_error() function http://php.net/manual/en/function.mysql-error.php