get all records by limit to 6

This is a discussion on get all records by limit to 6 within the alt.comp.lang.php forums, part of the PHP Programming Forums category; hi, i need to get only the first 6 records sorted by datetime from the thousands of records in existance. ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-14-2004
Gawie Marais
 
Posts: n/a
Default get all records by limit to 6

hi,

i need to get only the first 6 records sorted by datetime from the thousands
of records in existance. how do i do that ?

thus, only the latest 6 records added to the database should be displayed
and this can be done with the datetime field in the database. can anyone
help with the php code please ?



regards,

gawie.


Reply With Quote
  #2 (permalink)  
Old 06-14-2004
Paul Schmidinger
 
Posts: n/a
Default Re: get all records by limit to 6

select a from table order by date desc limit 0,6

I hope I understood you right.

Paul
www.eigelb.at

"Gawie Marais" <gmlists@gam.co.za> schrieb im Newsbeitrag
news:cajg3e$d78$1@ctb-nnrp2.saix.net...
> hi,
>
> i need to get only the first 6 records sorted by datetime from the

thousands
> of records in existance. how do i do that ?
>
> thus, only the latest 6 records added to the database should be displayed
> and this can be done with the datetime field in the database. can anyone
> help with the php code please ?
>
>
>
> regards,
>
> gawie.
>
>



Reply With Quote
  #3 (permalink)  
Old 06-14-2004
Gawie Marais
 
Posts: n/a
Default Re: get all records by limit to 6

thanx guys, it's working like a charm !!


"Paul Schmidinger" <schmidi@gmx.net> wrote in message
news:cajjnr$jec$1@newshispeed.ch...
> select a from table order by date desc limit 0,6
>
> I hope I understood you right.
>
> Paul
> www.eigelb.at
>
> "Gawie Marais" <gmlists@gam.co.za> schrieb im Newsbeitrag
> news:cajg3e$d78$1@ctb-nnrp2.saix.net...
> > hi,
> >
> > i need to get only the first 6 records sorted by datetime from the

> thousands
> > of records in existance. how do i do that ?
> >
> > thus, only the latest 6 records added to the database should be

displayed
> > and this can be done with the datetime field in the database. can anyone
> > help with the php code please ?
> >
> >
> >
> > regards,
> >
> > gawie.
> >
> >

>
>



Reply With Quote
  #4 (permalink)  
Old 06-14-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: get all records by limit to 6

*** Gawie Marais wrote/escribió (Mon, 14 Jun 2004 10:22:25 +0200):
> thanx guys, it's working like a charm !!


However, please note that LIMIT is a MySQL operator. Other database
management systems have a different syntax for that, or no syntax at all.
Just in case you're faced to PostgreSQL some day ;-)

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:59 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0