Php fans will like a variety of object-oriented source code, which can be used out of the box in terms of calling. the data displayed in the HA paging is only available for small functional modules.
Php fans will like a variety of object-oriented source codes, which can be easily used for calling, however, for small functional modules, the source code is not mentioned much,
A few years later, Tom found that there is no good habit of commenting on the code. Alas, this is very lacking. while doing php tutorials, it is very lacking, but it is still explained by the source code.
Class page {
Private $ pagesize;
Private $ page;
Private $ total;
Private $ conn;
Private $ pagecount;
Public function _ construct ($ pagesize, $ page ){
$ This-> pagesize = $ pagesize;
$ This-> page = $ page;
}
Public function listinfo (){
If ($ this-> page = "" |! Is_numeric ($ this-> page )){
$ This-> page = 1; // The initial value assignment process.
}
$ This-> conn = mysql_connect ("localhost", "root ","");
Mysql_select_db ("user", $ this-> conn );
Mysql_query ("set names utf8 ");
$ SQL = mysql_query ("select count (*) as total from user_student", $ this-> conn );
$ Info = mysql_fetch_array ($ SQL );
If ($ this-> total = 0 ){
Echo "no content ";
} Else {
If ($ this-> total % $ this-> page = 0 ){
$ This-> pagecount = intval ($ this-> total/$ this-> pagesize );
} Else {
If ($ this-> total <= $ this-> pagesize ){
$ This-> pagecount = 1;
} Else {
$ This-> pagecount = ceil ($ this-> total/$ this-> pagesize );
}
}
}
}
}
?>