Classification Statistics (cont.)

Source: Internet
Author: User
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:





































  • $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 ';
    numbering name NO. Object Name Driving distance miles travel time min Working time min travel speed km/h Arrival Time Departure Time

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.