This seems to always return 1 for $item_result->num_rows; even though there are 0 rows in the DB. However, if an item exists it updates the row correctly. I\'m sure something is
When you do SELECT COUNT(*) there will always be at least one result. Even if its 0.
SELECT COUNT(*)
You will need to fetch the result of the query to get the correct count.