php - Wrong part of if statement being executed -


When I delete a record from the table, I have 8 columns in the table and if more than 8 are entered So it should be shown that nothing was destroyed, although every number I give, I get a single response "Successfully deleted" This is my code:

  $ query = "Remove from order where order id = '$ _POST [ID]'"; $ Result = mysql_query ($ query); If (! $ Result) {echo ("$ _POST [ID] has not been deleted!  

$ result will be a valid result, even Use mysql_affected_rows () to check that your query will not affect any rows if you have deleted anything.

  $ result = mysql_query ($ query); If (mysql_affected_rows () == 0) {echo ("$ _POST [ID] was not deleted!  

Side note: mysql _ * functions dislikes do not use them to write new codes, especially when you are learning mysqli _ * or PDO.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -