Jump to content

php pagination with filter


paparts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.