Home >Database >Mysql Tutorial >Why is my MySQL UPDATE query returning \'0 Rows Affected\'?
MySQL UPDATE Query Returns "0 Rows Affected"
The MySQL UPDATE statement is used to modify the data in an existing table. One common issue encountered is receiving the message "0 rows affected" despite successful query execution.
In this particular case, the UPDATE query aims to update the Called column in the phonecalls table to "Yes" for a specific PhoneNumber. However, the query is returning "0 rows affected."
Understanding the Issue
The message "0 rows affected" indicates that no rows were changed as a result of the executed query. This can happen for several reasons:
Troubleshooting
To resolve this issue, consider the following steps:
UPDATE phonecalls SET Called = "Yes" WHERE PhoneNumber = "999 29-4655" AND Called <> "Yes";
By adding the condition Called <> "Yes," the query will only execute if the current value of the Called column is not "Yes."
The above is the detailed content of Why is my MySQL UPDATE query returning \'0 Rows Affected\'?. For more information, please follow other related articles on the PHP Chinese website!