Banging my head against a wall with this ! Hope someone can help ! Using MySQL
Trying to list cities with events for that month I've correctly (i think) formatted my date to a datetime style for MySQL $month is there chosen one $tosearch = date("Y-$month-d 00:00:00"); And then this is my inquiry $int is the number of days left if current month, 31 otherwise. But the weird thing is it always returns a result ? even if no events, and for this month where there are events it returns the city name 3 times ????? totally ignoring the distinct ! SELECT DISTINCT t_city_name,t_city_id_city, t_event_date FROM t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city = t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode ) AND ((t_location_sex = $pref) OR (t_location_sex = 6) OR (t_location_sex = 0)) AND (t_location_id_location = t_event_id_location) AND (t_event_date < (DATE_ADD('$tosearch', INTERVAL $int day)) ) ORDER by t_city_name I'm sure its something stupid but .... Can anyone help please! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php