#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    i know there are 40 records to show, but it only shows the first 20 split up in 10 records each page, so why is there no next option for the other 20 records?


    if(!$offset){
    $offset= "0";
    }
    //count the records
    $res = mysql_query( "SELECT count(*) from wijn where appelation='$appelation'");
    $records = mysql_result($res,0,"count(*)");

    //now do the select function with a limit and offset!

    $result = mysql_query("SELECT * FROM wijn WHERE appelation='$appelation' LIMIT $offset,10");



    if ($row = mysql_fetch_array($result)) {

    do {
    echo "<!-- appelation --><table border=0 cellpadding=0 cellspacing=0>
    <tr><td colspan=3><img src="images/leeg.gif" width="1" height="2" border="0"></td></tr>
    <tr><td><img src="images/leeg.gif" width="120" height="1" border="0"></td><td width=200>";
    ?><a href="show3.php?pid=<?print $row["ID"];?>"><?print $row["chateau"];?></a></td><td width=200><?

    print $row["appelation"];?></td></tr></table><?

    } while($row = mysql_fetch_array($result));

    } //else if ($search){
    //niks doen
    // echo "";

    // }
    else
    {

    //no results
    echo
    echo "Sorry, no records were found!";



    }





    if($appelation)

    {
    //find # of results left to show
    $results = "".($records-$offset)."";

    if($results < 10){
    //do nothing

    }

    if($offset !=0) {

    if($appelation = $appelation)

    { $appelation = urlencode($appelation);}

    echo "<table border=0 cellpadding=0 cellspacing=0><tr><td><img src="images/leeg.gif" width="120" height="1" border="0"></td><td><br>";

    echo ("<a href='search4_new.php?appelation=".($appelation)."&offset=".($offset-10)."'>PREVIOUS</a>");

    echo "</td></tr></table>";
    }

    else {

    if($appelation = $appelation)

    { $appelation = urlencode($appelation);}
    echo "<table border=0 cellpadding=0 cellspacing=0><tr><td><img src="images/leeg.gif" width="120" height="1" border="0"></td><td><br>";

    echo ("<a href='search4_new.php?appelation=".($appelation)."&offset=".($offset+10)."'>NEXT </a>");

    echo "</td></tr></table>";
    }

    }


    }

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    37
    Rep Power
    15
    no i did something wrong, ok sorry
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    79
    Rep Power
    15
    i think you did plenty wrong
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    i think you did plenty wrong
    >>


    yea, that is true..

    you need to re-write the script completly.

    i noticed couple big mistakes...
    here is that..


    <<
    //count the records
    $res = mysql_query( "SELECT count(*) from wijn where appelation='$appelation'");
    $records = mysql_result($res,0,"count(*)");
    >>


    the above will not work..
    include follwoing line insted of that..


    $res = mysql_query( "SELECT count(*) as total_rec from wijn where appelation='$appelation'");

    $rows = mysql_fetch_array($res);
    //get the record and save in an array.

    $records=$row["total_rec"];
    //total record that is going to display..

    Search here and find out a sample script from this forum..this question has asked many times in this forum..



    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. Highlight search result from mysql database search
    By Gurt in forum PHP Development
    Replies: 3
    Last Post: February 17th, 2004, 04:39 AM
  2. Cgi Search feature script
    By butsy_7 in forum Perl Programming
    Replies: 5
    Last Post: January 22nd, 2004, 08:43 PM
  3. Replies: 0
    Last Post: January 19th, 2004, 06:03 AM
  4. How can I perform a search with a previous search results?
    By charlie_tango in forum MySQL Help
    Replies: 1
    Last Post: January 17th, 2004, 11:06 AM
  5. search results errors!
    By clue05 in forum PHP Development
    Replies: 2
    Last Post: January 16th, 2004, 12:18 PM

IMN logo majestic logo threadwatch logo seochat tools logo