On 3/5/07, Jim Moseby <JMoseby@xxxxxxxxxxxxxxxxx> wrote:
> > I have been trying to find a way to search a DB and match a > range within a > week ( php & mysql ). > > This doesn't make sense, so I will describe it in more detail. > > > > Hi everyone, > > I need help with a search, lets say a record has a date of > 2/5/2007 and if > someone visits the website between 2/5/07 and 2/11/07 I want > to display the > record with 2/5/2007. > > If it's within the week so to speak. > > > > Does anyone know how I can accomplish this? > (You might get better answers from the MySQL list when asking MySQL questions.) SELECT * from table where record_date between '$begin_date' and '$end_date'; JM
There's probably a solution in here as well: $queryLocation1 = "SELECT `mrem_per_hour` as `Loc1`, if((date_time >= DATE_SUB(now(), interval 2 minute)), 'display', 'noDisplay') as `test` FROM `location1` ORDER BY `date_time` DESC LIMIT 1"; David