[thelist] SQL to select dates before x days

John Corry webshot at members.evolt.org
Wed May 15 19:51:01 CDT 2002


I am trying to write a query that will select all of the 'events' that
are within 45 days in the future of right now from my 'events' table.

// First, get now
$now = date("Y-m-d");

// query
$query = "SELECT * FROM `events` WHERE eventDateTime <=
date_add(".$now.", interval 45 day)";

I got the syntax for this query out of my movie schedule database...it
worked there, but it isn't working here....what am I doing wrong?

John Corry
Neon Cowboy Design
http://www.neoncowboy.com
mail : john at neoncowboy.com
phone : 808.572.8494




More information about the thelist mailing list