I've ordered a project from a developer, and I'm trying to fix the errors I find along the way.
One is a MySQL query with the DATE_FORMAT() function, that makes the query not return anything.
SELECT * FROM food_cart
WHERE cart_userId='3'
AND cart_itemId='8'
AND date_format(cart_date,'%Y-%m-%d %H')='".date("Y-m-d")."'
The code seems to be correctly formatted, as it does not return an error when executed in phpMyAdmin. It does however, not return anything.
The table looks like this:
I think it is supposed to try to look at just the date (i.e. 2011-10-07) and not the exact time, as it is not relevant for the query. I'm just a beginner at MySQL and I'm not quite sure what I'm doing here.
Any help appreciated!
Mike.