Results 1 to 2 of 2

Thread: Order data starting with set primary key

  1. #1
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default Order data starting with set primary key

    Hi,

    I have a search form that will return results. However, I want to have the results start displaying after a certain number (from the primary key). Say for example ... I have 78 rows...I want to start with id of 24...

    my code so far:
    PHP Code:
    $num $_GET['num'];

    $q $_GET['q'];

    mysql_query("SELECT * FROM users WHERE td LIKE '%$q%' LIMIT $num,$snum") or die(mysql_error());

    if(
    strlen($q) > 50) {
    echo 
    "Displaying 20 results per page"
    thanks
    - Josh

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I don't know if you've figured it out already, but did you try something like:
    Code:
    SELECT * FROM users WHERE td LIKE '%$q%' && id >= $start LIMIT $num,$snum
    Where $start is the number you want to start from?
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

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
  •