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
[EMAIL PROTECTED]
Phone: 616.276.9690
Fax: 616.342.8750
Nextel: 616.862.2847

"Don't work for recognition, but always do work worthy of recognition."




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to