Checking to see if a DELETE was successful from MSSQL

From: Date: Tue, 30 Apr 2002 16:43:51 +0000
Subject: Checking to see if a DELETE was successful from MSSQL
Groups: php.general 
Request: Send a blank email to php-general+get-95394@lists.php.net to get a copy of this message
Can anyone tell me the best way to check that a DELETE query was successful. I have tried using mssql_num_rows() and mssql_rows_affected() but it is always telling me that the DELETE was successful, even when it shouldn't have been. Here is the code that I am trying to work with right now. <? function delete_user($dbname, $user) { //connecting to db and getting table mssql_select_db($dbname) or die("Table unavailable"); //deleting user from user table $query = "DELETE FROM [users] WHERE [user] = '$user'"; $result = mssql_query($query) or die("Unable to delete user"); if(mssql_num_rows($result) > 0) echo "User successfully deleted.<br>\n"; else echo "User does not exist<br>\n"; } ?> *Running PHP 4.1.2 on Windows NT 4.0 with MS SQL Server 2000 -- Joshua E Minnie/CIO josh@acsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847 "Don't work for recognition, but always do work worthy of recognition."

« previous php.general (#95394) next »