What does a successful MySQL DELETE return? How to check if DELETE was successful?

前端 未结 4 746
天涯浪人
天涯浪人 2020-11-27 16:45

Using PHP, I am trying to delete a record, but I want to check if it was successful or not. Is anything returned from a successful DELETE FROM foo where bar = \'stuff\

4条回答
  •  心在旅途
    2020-11-27 17:17

    you could try this for your php code, placed after your query runs:

    if (mysql_affected_rows() > 0) {
        echo "You have successfully updated your data.

    "; } else { echo "The data you submitted matched the current data so nothing was changed.

    "; }

提交回复
热议问题