Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 14-02-07
Registered User
 
Join Date: Aug 2003
Location: Great Yarmouth, UK
Posts: 573
Thanks: 0
Thanked 0 Times in 0 Posts
Freebie is an unknown quantity at this point
  pulling last record from a database

Hi all,

Im hoping someone can help me a little. Im developing a new site. The site lists records from a SQL database, and im using php.

I want to make a feature of the last record added to the database. I can do this in my own primative way by querying the database as to how many records there are each time the page is shown, then echoing the record at the result.

ie
How many records are there?
answer 100
echo record 100

Im assuming this is using a lot of resources though, and there's probably a way of directly asking for the last record?

Any help is much appreciated.

Carl
__________________
Freebieholics
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 14-02-07
morleymouse's Avatar
Super Member
 
Join Date: Aug 2003
Location: Costa Del Sheffield
Posts: 2,752
Thanks: 3
Thanked 10 Times in 6 Posts
morleymouse is an unknown quantity at this point
  Re: pulling last record from a database

Hi Carl,

Id be adding an auto incrementing field, ID or something like that, then to get the last record just ORDER BY ID desc LIMIT 1

Thats how I do it anyway
__________________
Dan Morley
Alpharooms.com
daniel at alpharooms dot com - Hotels, Flights, Airport Transfers, Care Hire + More! sign up
My Blog | Cheap Holidays
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 14-02-07
Registered User
 
Join Date: Aug 2003
Location: Great Yarmouth, UK
Posts: 573
Thanks: 0
Thanked 0 Times in 0 Posts
Freebie is an unknown quantity at this point
  Re: pulling last record from a database

Thanks for that, i can be so dumb sometimes - i use that all the time, but never thought of using it to get at the last record!!
__________________
Freebieholics
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
mobile phone database DutchRomano The Affiliate Marketing Lounge 4 17-10-08 12:17 PM
mySQL - which is faster - 4 large tables in one database or a database for each? giveasyouget Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 6 21-01-07 04:30 PM
Relational or Flatfile Database? Donk Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 19 20-10-06 11:51 AM
Affiliate links stored in a database Nigel Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 4 07-01-04 02:46 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7