I am having trouble pulling a query where i want to return results that contain a particular word in a field AND that are between a certain date range. The query i am using now is:
$month_no = date('m');
$month_day = date('d');
$query="SELECT * FROM `table` WHERE ((user_purchased LIKE '%john%') AND (request_date BETWEEN '2011-$month_no-$month_day' AND '2011-$month_no-$month_day')) ";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result); echo $num_rows;
My date format in the ‘request_date field is like this:
2011-10-03 12:30:34
Any ideas on what i am doing wrong?
Thanks!
What happens if you try: