Jump to content


Photo

beginner question-- newest 5 entries


  • Please log in to reply
3 replies to this topic

#1 arakay

arakay
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 September 2003 - 07:22 PM

I\'m making an automated link directory to kinda teach myself php and mySQL. I want to make a \"newest five links\" thing on the main page. I know how to select the information from the table, etc, and that I should include ORDER BY id DESC so that the entry with the highest number will appear first. I just can\'t figure out how to make it stop after 5. Help for the newbie? *hopeful look*

#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 01 September 2003 - 08:33 PM

you could add the LIMIT 5 clause. i think this limits the results to 5 rows.

#3 Dissonance

Dissonance
  • Members
  • PipPip
  • Member
  • 12 posts
  • LocationChicago, IL

Posted 01 September 2003 - 11:47 PM

\"SELECT * from LINKS ORDER BY id DESC LIMIT 5,0\"

That should do it.
Friends don't let friends vote Republican.

#4 arakay

arakay
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 September 2003 - 02:14 AM

Thanks! That made it work! *grin*




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users