dynamic selection of content - ermm... help!
Posted 10 October 2006 - 03:51 PM
I am building a news delivery site - with the news being delivered in 3 areas. The first should have the latest news item, the second area the second most recent item, and the third area, latest stories 3-7.
How can I get PHP to select the last item, next to last, and then 3-7 since the ID's of these items will change as new items are added all the time?
I know there is probably a very simple answer to this - but I've not found one yet
Posted 10 October 2006 - 03:56 PM
You can find a link to the MySQL manual in my signature.
Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools
Posted 10 October 2006 - 04:05 PM
Area 1: Latest
<?php $query = 'SELECT * FROM "news" ORDER BY "date" DESC LIMIT 0,1'; ?>
Area 2: 2nd Latest
<?php $query = 'SELECT * FROM "news" ORDER BY "date" DESC LIMIT 1,1'; ?>
Area 3: Results 3 to 7
<?php $query = 'SELECT * FROM "news" ORDER BY "date" DESC LIMIT 2,5'; ?>
'date'with whatever your columns are named. You might also want to read the suggested documentation to know how everything works.
Posted 10 October 2006 - 04:11 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users