I have a bunch of dates in a field of a table in a MySQL database. I need PHP to find any dates in that field that are between whatever the current date is and 7 days from the current.
For example, if the current date was 10/27/2005, I would need to find all dates in the field between 10/27/2005 and 11/03/2005.
Any ideas?!
SELECT * FROM table WHERE datefield BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)
Thank you! I understand that code. It succesfully pulls the information for each row. But now how do I seperate the columns so I can display them seperately?
(ie, the date, name, descriptoin, etc.)
that's exactly what SELECT * does (select all)
But now how do I seperate the columns so I can display them seperately? I want the date in one place, the location in another, etc.
loop thru the result and spool each row into an array. you didn't mention which database you use but if it's mySQL look at [man]mysql_fetch_array[/man] and [man]mysql_fetch_assoc[/man].