[thelist] php/mysql : selecting all rows that match a date range

John Corry john at neoncowboy.com
Fri Jan 4 15:14:19 CST 2002

I'm hoping it's the cold medicine that is keeping me from being able to do

I have a DB with 2 tables, table 1 = movies ; table 2 = showtimes. Each
movie has 2 or more showtimes.

I'm working on a simple script to select all of the movies that have
showtimes within one month from now and display them on the page.

I'm hitting the wall because I can't use substr("showings.showTime", 5, 6)
in my query, since that's a string, not a reference to the field I want to
check against.

So I found the adddate function in mysql book, this looks like what I want.
But the query "select filmTitle, filmDescr, filmImage, filmDirector,
filmRating, filmRuntime, filmLink, showings.showingDate from films, showings
where showings.showingDate <= DATE_ADD(showings.showingDate, INTERVAL 1

Doesn't behave as expected...it returns films matching that criteria, but
like...6 times each!

What am I doing wrong?


More information about the thelist mailing list