PHP after the page, serial number again start the problem + urgent urgent?
$MYSQL->query ("Select Cu.*,cy.name from Customer cu,custtype cy where 1=1 and Cu.code=cy.code limit 0,18");
for ($i =1; $i < $count; $i + +) {
$MYSQL->fetch ($i);
$customerid = $MYSQL->data[customerid]; Customer number
$KSName = $MYSQL->data[ksname]; User name-abbreviation
echo "$i"; Serial number
echo "$customerid"; Customer number
echo "$KSName"; User name-abbreviation
?>
I am every 18 records for a page, the first serial number is from 1-18, but I switch to the 2nd page, the serial number is from 1 to 18th, the same as the 3rd page, probably because I paged, I tried, if there is no problem, but here I can not page, Please do not have a good way to solve this problem.
PHP php? After the page change, the problem of serial number?
Share to:
------Solution--------------------
Set the desired page number to be passed in by $_get[' page '), there is
$offs = * Isset ($_get[' page ')? $_get[' page '-1:0;
$MYSQL->query ("Select Cu.*,cy.name from Customer cu,custtype cy where 1=1 and Cu.code=cy.code limit $offs, 18");
$MYSQL->fetch ($i);
$customerid = $MYSQL->data[customerid]; Customer number
$KSName = $MYSQL->data[ksname]; User name-abbreviation
echo "$i"; Serial number
echo "$customerid"; Customer number
echo "$KSName"; User name-abbreviation
------Solution--------------------
Citation:
#14, brother, you don't know, the problem, don't be nonsense. Ok!!!!!!!!!!
When you change the page number, it should be to get the URL of the incoming $page value, such as $_get[' page ';
Then, every time you page, there is a $page_size, your $page_size=18;
So, when you display on the page, the ID number of that list should be: ($page-1) * $page _size+ $i; The $i value is the subscript of the array.
$page =$_get[' page ';
$page _size=18;
$count = $MYSQL->query ("SELECT count (*) from Customer Cu,custtype Cy where 1=1 and Cu.code=cy.code");