Re: [PHP] Need some help with this idea!

2001-07-24 Thread Chris Cocuzzo

you bring up something I've been wondering about, can I fetch just a single
row to output?

chris


- Original Message -
From: Remo Pini <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 24, 2001 11:13 AM
Subject: RE: [PHP] Need some help with this idea!


> select * from whatnot order by timestampcolumn desc limit 1
>
> if the "limit 1" doesn't work with your db, just fetch the first result
> only...
>
> greets,
> remo
>
> > -Original Message-
> > From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 24, 2001 8:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Need some help with this idea!
> >
> >
> > hey-
> >
> > I want to select the oldest show from a database to display on my
> > main page,
> > since the oldest show is also the show happening closest to any current
> > time(if that makes sense...). I included a timestamp field in my table
of
> > shows in anticipation of checking that to find out what was the oldest.
> > however, I'm wondering how I should go about doing that exactly.
> > my idea was
> > the scan through just that column of timestamps, find the lowest one,
and
> > then make a selection from the db based on the timestamp. Can any give
me
> > some examples of code to scan through a column like i mentioned,
> > or give me
> > better ideas on how to do this??
> >
> > thanks
> > chris
> >
> >
> > --
> > PHP General 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 General 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 General 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]




RE: [PHP] Need some help with this idea!

2001-07-24 Thread Remo Pini

select * from whatnot order by timestampcolumn desc limit 1

if the "limit 1" doesn't work with your db, just fetch the first result
only...

greets,
remo

> -Original Message-
> From: Chris Cocuzzo [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 8:28 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Need some help with this idea!
>
>
> hey-
>
> I want to select the oldest show from a database to display on my
> main page,
> since the oldest show is also the show happening closest to any current
> time(if that makes sense...). I included a timestamp field in my table of
> shows in anticipation of checking that to find out what was the oldest.
> however, I'm wondering how I should go about doing that exactly.
> my idea was
> the scan through just that column of timestamps, find the lowest one, and
> then make a selection from the db based on the timestamp. Can any give me
> some examples of code to scan through a column like i mentioned,
> or give me
> better ideas on how to do this??
>
> thanks
> chris
>
>
> --
> PHP General 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 General 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]




RE: [PHP] Need some help with this idea!

2001-07-23 Thread Don Read


On 24-Jul-2001 Chris Cocuzzo wrote:
> hey-
> 
> I want to select the oldest show from a database to display on my main page,
> since the oldest show is also the show happening closest to any current
> time(if that makes sense...). I included a timestamp field in my table of
> shows in anticipation of checking that to find out what was the oldest.
> however, I'm wondering how I should go about doing that exactly. my idea was
> the scan through just that column of timestamps, find the lowest one, and
> then make a selection from the db based on the timestamp. Can any give me
> some examples of code to scan through a column like i mentioned, or give me
> better ideas on how to do this??
> 
> thanks
> chris
> 


'Old'-est - order by your_timestamp asc 
'New'-est - order by your_timestamp desc 

   ... limit x;

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General 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]




Re: [PHP] Need some help with this idea!

2001-07-23 Thread David Robley

On Tue, 24 Jul 2001 15:57, Chris Cocuzzo wrote:
> hey-
>
> I want to select the oldest show from a database to display on my main
> page, since the oldest show is also the show happening closest to any
> current time(if that makes sense...). I included a timestamp field in
> my table of shows in anticipation of checking that to find out what was
> the oldest. however, I'm wondering how I should go about doing that
> exactly. my idea was the scan through just that column of timestamps,
> find the lowest one, and then make a selection from the db based on the
> timestamp. Can any give me some examples of code to scan through a
> column like i mentioned, or give me better ideas on how to do this??
>
> thanks
> chris

I'm not exactly sure what you want here, but it seems like you could do a 
select where timestamp (<= or >= ) NOW() and then ORDER the result ASC or 
DESC according to your needs.

Frinstance, to get the first show on or after today you could select 
where timestamp is greater than or equal to NOW(), ORDER by timestamp and 
LIMIT 1 to get the earliest in the future. Which might be today! You can 
do some fancy formatting of the timestamp in Mysql, if that helps.

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Only cosmetologists give make-up exams.

-- 
PHP General 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] Need some help with this idea!

2001-07-23 Thread Chris Cocuzzo

hey-

I want to select the oldest show from a database to display on my main page,
since the oldest show is also the show happening closest to any current
time(if that makes sense...). I included a timestamp field in my table of
shows in anticipation of checking that to find out what was the oldest.
however, I'm wondering how I should go about doing that exactly. my idea was
the scan through just that column of timestamps, find the lowest one, and
then make a selection from the db based on the timestamp. Can any give me
some examples of code to scan through a column like i mentioned, or give me
better ideas on how to do this??

thanks
chris


-- 
PHP General 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]