Php code for simple page jump. Not to mention, copy the code directly. the code is as follows: connect to the database to query the mysql_connect (localhost, username, userpwd) ordie (database connection failure. mysql_error (); mysql_s is not much to say, directly add the code
The code is as follows:
// Query the connected database
Mysql_connect ('localhost', 'username', 'userpwd') or die ("database connection failed". mysql_error ());
Mysql_select_db ('database name ');
Mysql_query ('set names utf8 ');
$ Sql1 = "select * from user ";
$ Query1 = mysql_query ($ sql1 );
$ Count = array ();
While ($ row = mysql_fetch_assoc ($ query1 )){
$ Count [] = $ row;
}
$ Totalnews = count ($ count );
// Determine the page
If ($ _ GET ['Page']) {
$ Page = $ _ GET ['Page'];
} Else {
$ Page = 1;
}
$ Start = ($ page-1) * $ newnum;
$ SQL = "select * from user limit $ start, $ newnum ";
$ Query = mysql_query ($ SQL );
$ Ret = array ();
While ($ row = mysql_fetch_assoc ($ query )){
$ Ret [] = $ row;
}
?>
// Table style
$ Value) {?>
|
|
|
Delete | modify |
// Page jump
Homepage> Previous Page / "> Next Page"> Last Page |
The following code links to the database: // query mysql_connect ('localhost', 'username', 'userpwd') or die ("database link failed ". mysql_error (); mysql_s...