mySQL UPDATE query returns "0 rows affected"
The problem might be that there are no records with PhoneNumber == "999 29-4655"
.
Try this query:
SELECT * FROM phonecalls where PhoneNumber = '999 29-4655'
If it doesn't return anything, then there are no rows that match.
Another reason for 0 affected rows that I have observed: wrong data type. If the column you want to update is an integer or boolean, and you set it to a string, it won't be updated - but you will also get no error.
To sum up the other strategies/ideas from this post:
- Check with a
SELECT
statement, whether your WHERE works and returns results. - Check whether your columns do already have the value you want to set.
- Check if your desired value suits the data type of the column.
If the values are the same, MySQL will not update the row (without triggering any warning or error), so the affected row count will be 0.
If the such value already exists, mysql won't change it and will therefore return "0 rows affected". So be sure to also check the current value of called