logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-03-2007, 08:20 PM   #1
Psybernaut
 
Join Date: Aug 2007
Location: Cape Town, SA
Posts: 10
Default show first record, then a list for the rest

Hi Guys,

Can someone please point me in the right direction. I'm sure there is a relatively simple solution for this but I can't quite wrap my head around it.

Basically I have a list of article in the database. I want to show the most recent one in full (This is no problem, I have ordered the result by date and only show the first record), but I also want to show just the heading and date of all the other articles below it, obviously excluding the first record which is already shown. I thought perhaps I should use a second SELECT statement with a LIMIT clause, something like LIMIT 2,999999 so that it will always be greater than the total number of articles.

Am I barking up the wrong tree?

Last edited by Psybernaut; 09-03-2007 at 08:37 PM..
Psybernaut is offline   Reply With Quote
Old 09-03-2007, 08:40 PM   #2
owner
 
Join Date: Sep 2007
Posts: 64
Default

Do you have msn? If so pm me your email and I will try to help you out.
owner is offline   Reply With Quote
Old 09-04-2007, 08:28 AM   #3
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

let me know if this gets resolved
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 09-04-2007, 12:43 PM   #4
Psybernaut
 
Join Date: Aug 2007
Location: Cape Town, SA
Posts: 10
Default

Haven't had a chance to chat with 'owner' yet but the LIMIT 1,999999 idea does work although this requires two SELECT's (one for the article, one for the list) with different filters from the same table which seemed like an unnecessary duplication. I just thought there was probably a much cleaner way to do it.
Psybernaut is offline   Reply With Quote
Old 09-04-2007, 06:23 PM   #5
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

If you can resolve this in the forum, instead of IM, other members will get some help as well.
domedia is offline   Reply With Quote
Old 09-12-2007, 08:17 AM   #6
petersson
petersson's Avatar
 
Join Date: Sep 2007
Location: Sweden
Posts: 3
Thumbs up

I think you have to do two recordset. One for the latest and one for the headings. On the heading recordset you put a repeat region.
petersson is offline   Reply With Quote
Old 09-12-2007, 09:53 AM   #7
Psybernaut
 
Join Date: Aug 2007
Location: Cape Town, SA
Posts: 10
Default

Yes, that is exactly what I did. I used one SELECT statement (Recordset) for the full article and one for the listing, using a LIMIT clause to remove the first record...


SELECT *
FROM newsletter
ORDER BY newsletter.`date` DESC

SELECT *
FROM newsletter
ORDER BY newsletter.`date` DESC LIMIT 1,999999


I just thought maybe there was a more 'streamlined' way to do it, which only required the data to be pulled out once, but this method works fine.
Psybernaut is offline   Reply With Quote
Old 09-12-2007, 10:26 AM   #8
petersson
petersson's Avatar
 
Join Date: Sep 2007
Location: Sweden
Posts: 3
Default

Glad you solved it.
petersson is offline   Reply With Quote
Old 09-12-2007, 10:43 AM   #9
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

i would have thought ( not that i know) but one select and one echo result and then another echo result in a do loop with conditions, producing more. Any of these methods would repeat the first record though. I think
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas

Last edited by edbr; 09-12-2007 at 11:01 AM.. Reason: stupidity
edbr is offline   Reply With Quote
Reply


Thread Tools
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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:50 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com