Re: weeks
| From: | Christian Reiniger | Date: | Thu, 08 Mar 2001 18:29:15 +0000 |
| Subject: | Re: weeks | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43056@lists.php.net to get a copy of this message | ||
On Thursday 08 March 2001 18:49, you wrote:
> Anyone know offhand a way to organize the output from a query by week?
> I'm writing a work log app and I want the admin to see everyone's work
> ordered first by lastname, and then by date. But only want that week's
> data to show up, and maybe a dropdown with previous weeks available.
> Don't go thinking about an answer, cuz I'm doing that, but if anyone
> already knows how to solve this problem or part of it, lemme know.
> Thanks once again.
for MySQL add a WHERE (WEEK(yourtimefield) = WEEK(NOW()))
this will have the problem that it will show all of week X even if you're
on 23:55 on the last day of that week
WHERE ((yourtimefield >= NOW()) AND (yourtimefield <= DATE_ADD(NOW(),
INTERVAL 1 WEEK))
might be better
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
..10001000110101011010101101011110111010113...????