mysql+php分页类(已测)

2019-04-10 22:08:18刘景俊

       if($i == 1 && $this->page > 1)  #Prints the << first to goto the previous page (not on page 1)        
          echo "<a href="$PHP_SELF?page=".($this->page - 1)."" onMouseOver="status="Previous Page";return true;" onMouseOut="status=" ";return true;">?</a>";        

       if($i == $this->page)  #Doesn"t print a link itself, just prints page number       
          echo "<font color="#ff3333"> $i </font>";        

       if($i != $this->page)  #Other links that aren"t this page go here       
          echo "<a href="$PHP_SELF?page=$i" onMouseOver="status="Go to Page $i";return true;" onMouseOut="status=" ";return true;"> $i </a>";        

       if($i == $this->total_pages && $this->page != $this->total_pages)  #  Link for next page >>  (not on last page)        
          echo "<a href="$PHP_SELF?page=".($this->page + 1)."" onMouseOver="status="Go to the Next Page";return true;" onMouseOut="status=" ";return true;">?</a>";        
       }      

    echo "</div>n";        
  }      

}      

/*     
   mysql_connect($server, $uname, $pass );     
   mysql_select_db("$db");     
   $result= @mysql_query("Select * FROM table");     

   $p = new mysql_pager( $result, $page=$_GET["page"], 10 );     
   $p->print_navigation();     
相关文章 大家在看