Hi Marc,

If I understand your question correctly, the SQL Syntax you might want to
try would be:

SELECT col_1, col_2 FROM table_name WHERE date_col >= $from_date AND
date_col <= $to_date

Or if you want to get each days results individually, you could do something
like this in a loop, where $loop starts at 0 and is incremented and
$from_date is the date you wish to start out with:

SELECT col_1, col_2 FROM table_name WHERE date_col = DATE_ADD("$from_date",
INTERVAL $loop DAY)

I'm sure there are at least a dozen other ways to attack this, hopefully
these will give you something to work with and are perhaps helpful.

Enjoy!

Tyrone

-----Original Message-----
From: Marc Johnson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 4:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Trying to pull a weeks worth of data of a DATE entry


I am trying to pull a weeks worth of data from MySQL from a DATE var field.
Which in turn I can seperate to each days 'entries' sorted by date AND time.
Basically trying to set up a page to pull 'news entry date' sorted by date
and time, with each
day having its own header (like you see on so many websites) and having that
header appear
only once per days worth of 'news'.

Not really sure where to start considering I have only been at this for two
days. My scripting skills
are limited so far so I am sure that the approach I am taking is the hard
way.

Can anyone provide me with a link to examples of this code (the actual code)
so I can see how it has been done?
Or perhaps if its a easy solution (i.e. SELECT date "(from date to date)"
type command). I have seen examples of
sorting by date and munipulation of the date via SELECT, but cant seem to
pinpoint how to extract only from-to dates.
Even if I can use a SELECT command where date = x would work.

Any help, or pointing in the right direction would be greatly appreciated
(and probably save money on my Rogain bills).

Thanks,

Seriously Confused in Seattle,
Marc



I have tried multiple attempts at some variation of:

   $week_var = 7;
   $tdate = getdate();
   $yday_var = $tdate['yday'];
   $wdate = $yday + $week_var;


Granted



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to