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. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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. > > |
|
|||
|
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. > > > > > > |
|
|||
|
*** 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 -- |