Ask the ID of the PHP database table How to make it appear in the page from 1 increment ordinal

Source: Internet
Author: User
Tags php database
Ask the ID of the PHP database table How to make it appear in the page from 1 increment ordinal
Auto-increment of ID settings in database tables but sometimes the ID is not consistent when inserting data fails or when data is deleted
I would like to output a page with each data 1 2 3 4 5 6 ..... Show in this order

I tried this one. Single-page display very simple problem is that my data is paged by the Limit statement page
To the second page from 1 2 3 4 5 .... The sequence number begins to show the

That's not a simple question.

------Solution--------------------
You're not going to change the ID in the table, but show sequential numbers when they're displayed.
Is that the only way?
Ordinal Initial value = (page number-1) * Number of rows per page +1
------Solution--------------------
The first page is 1-10 that second page is 11-20 that is the initial value (2-1) *10 and then the loop output data, the sequence number is also incremented by 1 on the line.
------Solution--------------------
Take a look at the example of the pagination class and you'll see how many pages you get total divided by the number of pages per page, looping through the pages.
  • Related Article

    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.