Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts

    how to make a page go to the last id from paper table

    when a user on my site clicks on the paper link (its like a newpaper) i want them to be taken to the last issue of the paper, however im not to sure how to do this with the script ive got, as i will be using the if (empty($_GET)) of if ($_GET == "") so my question is, how can i make the mysql query select as default the last id in the table?

    also i see on websites, that they have a little part of an article display, then a link to read the entire article, how is this possible, its more of an "insight" i guess, is it done using css or php?

    Cheers.

    Dan
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts
    answers in reverse order:

    They are called trailers. you simply grab x words from the front of the article and add the elipse ... (spelling). See http://www.webdeveloper.com/forum/sh...ad.php?t=56823

    The query: use ORDER BY id DESC, the first result will be the most recent addition to your database PROVIDING your id field is auto-increment

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    I will look into this, thanks for helping me with that part, i would never of had a clue what it was called inorder to search for it


    Quote Originally Posted by litebearer View Post
    answers in reverse order:

    They are called trailers. you simply grab x words from the front of the article and add the elipse ... (spelling). See http://www.webdeveloper.com/forum/sh...ad.php?t=56823

    Quote Originally Posted by litebearer View Post
    The query: use ORDER BY id DESC, the first result will be the most recent addition to your database PROVIDING your id field is auto-increment

    with the above quote, i would called it like this from the paper table and yes to your question, the id feild is auto-increment.

    PHP Code:

    $paperquery 
    mysql_query("SELECT id FROM paper ORDER BY id DESC");
    $paper mysql_fetch_object($paperquery); 
    so would i call it as normal using $paper->id ?

    Cheers.

    Dan
    Last edited by Dan13071992; 02-25-2012 at 08:32 PM.
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags


  •  

    Posting Permissions

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