Jump to content

Recommended Posts

http://www.lotsofcode.com/php/php-array-pagination.htm

I am using this code for my pagination but I'm using the database instead of arrays.

I have a text field in w/c i enter a name and page all the results with the name I inputed.

It does take effect only on the first page after click next all the names in the database are there.

can i ask ideas on how to manage.

tnx

Link to comment
https://forums.phpfreaks.com/topic/118590-php-pagination-with-filter/
Share on other sites

where is that? my code is like this.

 

case 'syslog':
   
      isLogin();
      
      $body->assign('show_menu',showMenu());
      
      $getUsername = $_REQUEST["username"];
      $getDate = $_REQUEST["date"];
      
    //if($getUsername || $getDate){

    if($getUsername || $getDate) {
    $query = mysql_query("SELECT * FROM syslog WHERE username LIKE '$getUsername%' 
                            AND act_date LIKE '$getDate%'");
    }
    else{
    $query = mysql_query("SELECT * FROM syslog WHERE username LIKE '$getUsername%' 
                          AND act_date LIKE '$getDate%'");
    }
     $myArray = getData($query);
     if ($count = count($myArray)) {
          $pages = $pagination->generate($myArray, 10);
          if (count($pages) != 0) {
          $pageNumbers = $pagination->links();
          
            $body->assign('sysloglist', $pages);
            $body->assign('task','syslog');  
            if($count>10) {
            $body->assign('pageNumber' , $pageNumbers);
            }
            else{
            $less = '<font color = "#cccccc">' . '&laquo Prev'. '  ' . ' Next &raquo' .'</font>';
            $body->assign('pageNumber' , $less);
            
            }
          }
        }

where should i put the value?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.