Old 03-02-2007, 11:38   #1 (permalink)
mgpwr
with a hint of lemon
 
mgpwr's Avatar
 
Join Date: Aug 2006
Location: Sheffield
Posts: 495
database

Hello everyone

Would anyone know of a tutorial of a script that i can add to my page that will display the most recent information only added to a database?

Thanks
__________________
Online portfolio: mgpwr.co.uk
  Reply With Quote
Old 03-02-2007, 11:45   #2 (permalink)
datahound
Spare Parts
 
datahound's Avatar
 
Join Date: Jan 2005
Location: Bracknell Forest
Posts: 4,931
If the records all have dates then you can..

Select all from db sort by date.

Print record while $count less than 5

$count++
__________________
  Reply With Quote
Old 03-02-2007, 17:15   #3 (permalink)
freelancr
Senior Member
 
freelancr's Avatar
 
Join Date: Oct 2006
Posts: 2,152
Quote:
Originally Posted by datahound
If the records all have dates then you can..

Select all from db sort by date.

Print record while $count less than 5

$count++

Surely it would be more efficient to use the LIMIT command, in the SQL query. Therefore you load only the 5 rows you will be displaying into the array, instead of all of them.
  Reply With Quote
Old 05-02-2007, 08:59   #4 (permalink)
mgpwr
with a hint of lemon
 
mgpwr's Avatar
 
Join Date: Aug 2006
Location: Sheffield
Posts: 495
can you point me to a decent tutorial that will guide me through it!


Thanks
__________________
Online portfolio: mgpwr.co.uk
  Reply With Quote
Old 05-02-2007, 09:07   #5 (permalink)
BasicMind
Senior Member
 
Join Date: Jan 2007
Location: Edinburgh
Posts: 197
what database. MySQL/PHP ASP/MSSQL etc...

dont know any tutorials you could try Spoono. but if you are using mysql/php and you've setup an id column in an auto increment

Code:
SELECT * FROM table ORDER BY id DESC

then you can loop how ever many you want
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8