how to show all recordes inserts in a table for the last 7 days

how to show all recordes inserts in a table for the last 7 days

am 15.09.2006 13:20:03 von Muhammad Mustafa

hey guys
i want to know how to show all records inserted in the last 7 days in a
table
i use this query to show the last 10 articles from a table called - articles
- where time is saved in the vairble - $tim - down is the query:

$SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] .
'\' AND type=0 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC
LIMIT 10';

i want to edit it to show every day all articles inserted in the last 7 days
from table articles ....
how can i edit this query??
please help me any body as fast as you can
many thankx for your efforts :)

____________________________________________________________ _____
Search from any web page with powerful protection. Get the FREE Windows Live
Toolbar Today! http://get.live.com/toolbar/overview

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: how to show all recordes inserts in a table for the last 7 days

am 15.09.2006 15:48:54 von Bastien Koert

Assuming that tim is a pure timestamp column then try

select * from table where date_format(tim,'%Y-%m-%d) >= DATE_SUB(curdate(),
INTERVAL 7 DAY)


Bastien

>From: "Muhammad Mustafa"
>To: php-db@lists.php.net
>Subject: [PHP-DB] how to show all recordes inserts in a table for the last
>7 days
>Date: Fri, 15 Sep 2006 11:20:03 +0000
>
>hey guys
>i want to know how to show all records inserted in the last 7 days in a
>table
>i use this query to show the last 10 articles from a table called -
>articles - where time is saved in the vairble - $tim - down is the query:
>
>$SQL = '' . 'SELECT * FROM articles WHERE category=\'' . $_GET['cat_id'] .
>'\' AND type=0 AND status=1 AND tim<' . $_GET['tim'] . ' ORDER by tim DESC
>LIMIT 10';
>
>i want to edit it to show every day all articles inserted in the last 7
>days from table articles ....
>how can i edit this query??
>please help me any body as fast as you can
>many thankx for your efforts :)
>
>___________________________________________________________ ______
>Search from any web page with powerful protection. Get the FREE Windows
>Live Toolbar Today! http://get.live.com/toolbar/overview
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php