Classification Statistics (cont.)
Address of Post addressed previously
http://bbs.csdn.net/topics/390263234
Now on the address of that post, added the function of paging
It's too easy to think about the problem yourself. Thought is to press the SQL straight a point is finished, with paging does not matter.
There are several main problems
1. After clicking on the next page, the contents of the database can be displayed correctly, but on the date: ――no: – Name: This will show echo "No such record, is returning to the confirmation page";
equals the part that entered the else will return to the write.php page
2. Now the paging is the case that each page is a separate statistics page
Like the first name, 15 times a day, 10 records per page, 10 times on the first page will do a statistic on the second page for another 5 times.
If you want to change to not every page counts, but exactly according to the name, how should the statistics be rewritten?
Overall, is it necessary to change the paging method? For details, please.
Here is the complete code
Session_Start ();
?>
<title>Statistics page</title>
Include (' conn.php ');
$officename =$_post[' officename '];
$date =$_post[' Riqi '];
$sql 1= "SELECT * from the record where officename= ' $officename ' and searchtime like '% $riqi% ' order by name ';
$result 1=mysql_query ($sql 1);
if (mysql_num_rows ($result 1)!=0) {
$row =mysql_fetch_assoc ($result 1);
$officecode = $row [' Officecode '];
$_session["Riqi"]=$_post[' Riqi '];
$_session["Officename"]=$_post[' officename '];
$_session["Officecode"]= $officecode;
}
else{
echo "No such record is being returned to the confirmation page";
echo "
";
}
?>
Date:
――no:
– Name:
| numbering |
name |
NO. |
Object Name |
Driving distance miles |
travel time min |
Working time min |
travel speed km/h |
Arrival Time |
Departure Time |
$link =mysql_connect (' localhost ', ' root ', ' MySQL '); Database user name and database passwordmysql_select_db (' Berecord '); Database namemysql_query (' Set names UTF8 ');$Page _size=10; Set the number of displays per page$result =mysql_query ("select * from record where officecode= ' $officecode ' and searchtime like '% $riqi% ' order by name '); Record as 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;Judging the current page numberif (Empty ($_get[' page ') | | $_get[' page ']<0) {$page = 1;}else{$page =$_get[' page ';