php - mysql query issue

From: Date: Fri, 15 Sep 2006 12:35:36 +0000
Subject: php - mysql query issue
Groups: php.general 
Request: Send a blank email to php-general+get-241819@lists.php.net to get a copy of this message
Hi all. I am building an online events listing and when I run the following query I get the expected result set: SELECT events.id AS eventid, name, postcode, start_time, dates.date FROM events, dates_events, dates WHERE dates_events.event_id = events.id and dates_events.date_id = dates.id AND dates.date >= '$start_string' AND dates.date <= '$end_string' ORDER BY date ASC ...however, when I look for a one-off event the following query fails: SELECT events.id AS eventid, name, postcode, start_time, dates.date FROM events, dates_events, dates WHERE dates_events.event_id = events.id and dates_events.date_id = dates.id AND dates.date = '$start_string' ORDER BY date ASC ...if I query for that date in the dates table using this: SELECT * FROM dates WHERE date = '$start_string' I get the date record I expect. The second query above cannot seem to look for a date that equals the supplied string (BTW, all data has been escaped prior to interpolation in the query string!) Any ideas why not? I know it's more of a mySQL question so apologies in advance! -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk

« previous php.general (#241819) next »