Post address resolved before classification statistics (continued. Classification Statistics (continued)
Previously resolved Post address
Http://bbs.csdn.net/topics/390263234
Now the paging function is added to the address of the post.
I think the problem is too simple .. I thought it was all done by pressing SQL directly, and it had nothing to do with paging ..
The main problems are as follows:
1. after clicking the next page, the database content is displayed correctly, but on the date: -- NO: -- Name: Echo "there is no such record, and the confirmation page is being returned ";
The write. php page is returned when the else part is entered.
2. in this case, each page is an independent statistics page.
For example, if the first name has 15 records on a day, 10 records are displayed on each page, and 10 records on the first page will be recorded once, and another 5 records will be recorded on the second page.
How should we rewrite the statistics based on the name instead of every page?
In general, is it necessary to change the paging method? Please refer to the following link for more information:
The complete code is as follows:
Session_start ();
?>
Statistics page
Include ('Conn. php ');
$ Officename = $ _ POST ['officename'];
$ Date = $ _ POST ['riqi'];
$ Sql1 = "select * from record where officename = '$ officename' and searchtime like '% $ riqi %' order by name ";
$ Result1 = mysql_query ($ sql1 );
If (mysql_num_rows ($ result1 )! = 0 ){
$ Row = mysql_fetch_assoc ($ result1 );
$ Officecode = $ row ['officecode'];
$ _ SESSION ["riqi"] =_ _ POST ['riqi '];
$ _ SESSION ["officename"] = $ _ POST ['officename'];
$ _ SESSION ["officecode"] = $ officecode;
}
Else {
Echo "there is no such record, and the confirmation page is being returned ";
Echo"
";
}
?>
Date:
-- NO:
-- Name:
No.
Name
NO.
Object Name
Driving distance km
Travel time min
Job time min
Driving speed km/h
Arrival time
Departure time
$ Link = mysql_connect ('localhost', 'root', 'mysql'); // database username and password
Mysql_select_db ('berrecord'); // database name
Mysql_query ('set names utf8 ');
$ Page_size = 10; // you can specify the number of entries displayed on each page.
$ Result = mysql_query ("select * from record where officecode = '$ officecode' and searchtime like '% $ riqi % 'Order by name"); // record indicates the table name.
$ Count = mysql_num_rows ($ result );
$ Page_count = ceil ($ count/$ Page_size );
$ Init = 1;
$ Page_len = 7;
$ Max_p = $ page_count;
$ Pages = $ page_count;
// Determine the current page number
If (empty ($ _ GET ['Page']) | $ _ GET ['Page'] <0 ){
$ Page = 1;
}
Else {
$ Page = $ _ GET ['Page'];