php - Difference UPDATE on zero rows versus unchanged records?
Get the solution ↓↓↓Solution:
Just use a separate SELECT query prior to Update:
SELECT count(*) as count FROM uri WHERE f_site_id = '73' AND language_code = 'NL' AND additional = 'item' AND is_forwarder = '0'
Counting rows is not a very resource-intensive task and you do not seem to have many complex conditions.
If you want to optimize queries, then after the SELECT check for count value, and only run UPDATE query if it's >0. No sense in running Update if there's nothing to update.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to a member function format() on string
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.