On Monday 31 March 2003 22:07, Davy Obdam wrote: > I would like to select news from my database bases on week/year and > month/year. > How can i do this.. I would like to pass two arguments in the query > string, like news.php?week=14&year=2003 or news.php?month=3&year=2003. > Can anybody help me.. Thanks in advance. I have been looking at the > date() and mktime() functions, but is there anyway to determine the date > from a weeknumber? I have been using this:
[snip] > $sql = "SELECT * FROM news WHERE date>='$last_sunday' AND > date<='$next_saturday'). > > But i would find it better to use a weeknumber instead If you're using mysql you can do something like: SELECT * FROM news WHERE WEEK(date) = some_week_number_or_another If you're using some other DBMS check whether it has some similar function. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* We can predict everything, except the future. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php