php hyper link problem
Results 1 to 4 of 4

Thread: php hyper link problem

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    49

    php hyper link problem

    . I have 60 records in my database(mysql).
    1-I am displaying 5 records on same page “sortname.php”
    2-There are 4 links on this page. “First Preveous 1-60 Next Last”
    First will display first 5 records,
    Previous will display previous 5 and so on for Next and Last(last 5 records).
    If user is on first page the link of Previous and First should be disable
    Code:
    $result=mysql_query("select name,email,message from guest order by name limit $start,$display");		//query to retrieve 3 fields start from   1 to 5
    while($disp=mysql_fetch_array($result))		//display recods
    {
     echo "your name is $disp[name]<br>";
     echo "your email is $disp[email]<br>";
     echo "your messaege is $disp[message]<br><br><br>";
      }
    links to display
    Code:
    static $start=1;			//variable for start first record
    $d=mysql_query("select count(*) record from guest");		//retrieve total records from guest table
    $id=mysql_fetch_array($d);		
    $total=$id[record]; 		//total records
    $display=5;			// records to display
    $page=$total/$display;		//total pages
    $page=ceil($page);
    
    echo"<a href=sortname.php?start=$start&display=$display>first</a>
     <a href=sortname.php?start=  &display=$display>previous</a>
     <b>1 to $total</b>
     <a href=sortname.php?start=  &display=$display>next</a>
     <a href=sortname.php?start=$id&display>last</a>";
    I am unable to manage these links for First, Previous, Next Last
    I hope you understand my question.

  2. #2
    Member
    Join Date
    Apr 2004
    Posts
    49

    php hyper link problem

    . I have 60 records in my database(mysql).
    1-I am displaying 5 records on same page “sortname.php”
    2-There are 4 links on this page. “First Preveous 1-60 Next Last”
    First will display first 5 records,
    Previous will display previous 5 and so on for Next and Last(last 5 records).
    If user is on first page the link of Previous and First should be disable
    Code:
    $result=mysql_query("select name,email,message from guest order by name limit $start,$display");		//query to retrieve 3 fields start from   1 to 5
    while($disp=mysql_fetch_array($result))		//display recods
    {
     echo "your name is $disp[name]<br>";
     echo "your email is $disp[email]<br>";
     echo "your messaege is $disp[message]<br><br><br>";
      }
    links to display
    Code:
    static $start=1;			//variable for start first record
    $d=mysql_query("select count(*) record from guest");		//retrieve total records from guest table
    $id=mysql_fetch_array($d);		
    $total=$id[record]; 		//total records
    $display=5;			// records to display
    $page=$total/$display;		//total pages
    $page=ceil($page);
    
    echo"<a href=sortname.php?start=$start&display=$display>first</a>
     <a href=sortname.php?start=  &display=$display>previous</a>
     <b>1 to $total</b>
     <a href=sortname.php?start=  &display=$display>next</a>
     <a href=sortname.php?start=$id&display>last</a>";
    I am unable to manage these links for First, Previous, Next Last
    I hope you understand my question.

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    251
    Have a GOOGLE search...

    http://www.google.com/search?q=php+p...UTF-8&oe=UTF-8

    If the first response is still the phpfreaks website, that is a really handy tutorial.
    Perhaps you should browse some tutorials:
    http://www.zend.com/zend/tut/
    http://www.phpfreaks.com
    http://www.codewalkers.com
    http://www.phpbuilder.com
    There are several other great places for php tutorials, I just don't have links to them readily available.
    Ciao,
    Dhej
    The owl of Minerva spreads its wings only with the falling of dusk. -Hegel

  4. #4
    Senior Member
    Join Date
    Aug 2001
    Posts
    251
    Have a GOOGLE search...

    http://www.google.com/search?q=php+p...UTF-8&oe=UTF-8

    If the first response is still the phpfreaks website, that is a really handy tutorial.
    Perhaps you should browse some tutorials:
    http://www.zend.com/zend/tut/
    http://www.phpfreaks.com
    http://www.codewalkers.com
    http://www.phpbuilder.com
    There are several other great places for php tutorials, I just don't have links to them readily available.
    Ciao,
    Dhej
    The owl of Minerva spreads its wings only with the falling of dusk. -Hegel

Posting Permissions

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