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 2 of 2
  1. #1
    Regular Coder che_anj's Avatar
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    157
    Thanks
    12
    Thanked 3 Times in 3 Posts

    How to call function?

    hello anyone.. Ive made a pagination for my project, since all pages must have pagination, Ive decided to put into a function.. but I dont how to make it..

    Ive try to make this.. it works but theres a little error..

    PHP Code:

    function pagination($page,$totalrows,$pageprev,$pagenext,$lastpage){
    if(
    $page!=1)
        { 
            
    $pageprev $page 1;
            
    $firstpage=$page;
            echo 
    "<input type='button'  class='button-expand' value=\"&lt;&lt; FIRST\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1&page=1$sort&euser=\"'>&nbsp;";
            
           echo 
    "<input type='button'  class='button-expand' value=\"&lt;PREV\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$pageprev&euser=$euser\"'>&nbsp;";
             
        }
        else if(
    $totalrows $limit)
        {
            echo 
    '';
        }
        else
        {
            
    $pre=array("&lt;&lt;FIRST","&lt;PREV");
            
    $p=0;
            while(
    $p <=1):
          echo 
    "<input type='button' class='button-expands' value=\"$pre[$p]\">&nbsp;";        $p++; 
          endwhile;
                   
        }
        if((
    $totalrows - ($limit $page)) > 0)
        {
            
    $pagenext $page 1;     
            echo 
    "<input type='button' class='button-expand' value=\"NEXT &gt;\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$pagenext&euser=$euser\"'>&nbsp;";
           
               echo 
    "<input type='button' class='button-expand' value=\"LAST &gt;&gt;\" onClick='location.href=\"$PHP_SELF?click=client_list.php&menu=1$sort&page=$lastpage&euser=$euser\"'>";

        }
         else if(
    $totalrows $limit)
        {
            echo 
    '';
        }
        else
        {
        
    $pre=array("NEXT&gt;","LAST&gt;&gt;");
            
    $p=0;
            while(
    $p <=1):
          echo 
    "<input type='button' class='button-expands' value=\"$pre[$p]\">&nbsp;";        
          
    $p++; 
          endwhile;
        }

    if the page = lastpage the must class of the button must equal to class='button-expands' but it does not work at all..

  • #2
    Registered User
    Join Date
    Oct 2007
    Posts
    55
    Thanks
    4
    Thanked 2 Times in 2 Posts
    what's the error?


  •  

    Posting Permissions

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