Re: Date Times stuff

From: Date: Thu, 04 Jul 2002 23:54:39 +0000
Subject: Re: Date Times stuff
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-20322@lists.php.net to get a copy of this message
In article <070c01c222ac$a9f06ae0$04010a0a@fishworld>, john@webital.de says... > 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! Try echoing your query with the variables parsed, to see whether what you think is being passed is really being passed. -- David Robley Temporary Kiwi! Quod subigo farinam

« previous php.db (#20322) next »