php - mysql query issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux