note 70994 rejected from function.mssql-get-last-message by bobby

From: Date: Tue, 07 Nov 2006 18:02:54 +0000
Subject: note 70994 rejected from function.mssql-get-last-message by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119483@lists.php.net to get a copy of this message
Note Submitter: lanflett at hotmail dot com ---- Deleting an unexistent record causes mssql_query() to return FALSE (error) ====================================================== I wrote a code that deletes a set of records without verifying if that record ID exists before. I made this because of performance issues, since checking the existence of that record before deletion would require more interpreter and database processing. Problem is that, if I tried to delete a record ID that didn't exist (i.e. DELETE FROM X WHERE ID = 999, and 999 is an unexistent rec) mssql_query() returned FALSE, wich, by the function documentation means an execution error. Even when I tried to retrieve the error by using mssql_get_last_message() function or by selecting the error code from the system tables in SQL Server, there was no error. Therefore, I don't know if this is a mssql functions bug in PHP or a misconfiguration in SQL Server (wich doesn't seems to be the case, since it returns error code ZERO, meaning that the query executed successfully), but the only workaround I found was to do a verification of existence of the ID record by record before deleting them. Hope this helps someone that eventually came to face the same problem.

« previous php.notes (#119483) next »