error handling with ms sql server (mssql) - insert and update unique indexes
| From: | Heiko Mundle | Date: | Wed, 28 Aug 2002 07:18:14 +0000 |
| Subject: | error handling with ms sql server (mssql) - insert and update unique indexes | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21414@lists.php.net to get a copy of this message | ||
sorry for posting this mail twice, but the first one doesn't appear on the
news server (posting with google, doesn't work...)
Hi,
when I insert a new record with a unique indexed attribute, which is
already in the table, I only get some php warnings:
Warning: MS SQL message: Cannot insert duplicate key row in object
'user_profile' with unique index 'nickname'. (severity 14) in
c:\web\register\register.php on line 81
Warning: MS SQL: Query failed in c:\web\register\register.php on line
81
I want to identify the error and do some special php functions.
Unfortunately I don't get any message with "mssql_get_last_message()"
and "SELECT @@ERROR AS errorId" always returns "0".
changing the severity only gives different php warnings
mssql_min_error_severity (0);
mssql_min_message_severity (0);
How do I fetch and handle INSERT INTO and UPDATE SET warnings.
Is there any example on the internet?
Thanks for your hints
muhe