SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Luton, UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    archiving php web content

    Hi All
    I am still new to PHP but I am using it more and more on websites and one thing I am trying to do now is have a table that has weekly story recommendations in it and what I want to do every week is have the newest recommendation show up on the home page and the rest of the recommendations show up on an archive page.

    Does anybody know how I would go about doing that, or if you know of any tutorials that would be cool too.

    Thanks for your time

    Drew
    'As a computer, I find your faith in technology amusing'

  2. #2
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically on the frontpage, all you will be doing is selecting the latest item, on the date stored in your database, and in your archive page, selecting all the other items, except the latest one.
    Oh no! the coots are eating my nodes!

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Luton, UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks timnz - I'm sorry to sound dumb but I'm not so hot on PHP yet. How do I choose the first item from the database. Most tutorials only explain how you pull rows from a database and not one single item.

    Hope you can help

    Drew
    'As a computer, I find your faith in technology amusing'

  4. #4
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if the items have an ID number the latest one would have the highest number, correct? you query would be like this to get the latest item:

    PHP Code:
    $result mysql_query("SELECT title_or_whatever FROM articles ORDER BY id DESC LIMIT 1"); 
    or you could do the same thing with a date, but i'd use the ID.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  5. #5
    SitePoint Enthusiast
    Join Date
    Jun 2001
    Location
    Luton, UK
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks DR_LaRRY_PEpPeR. That's really kind of you. I'll give that a bash.
    Thanks again

    Drew
    'As a computer, I find your faith in technology amusing'


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •