使用PHP创建新页面? [关闭]

I have an equipment database. There are 972 different items in that database. Including an image url, asset number, title, description, shipping weight, etc. I have a php script that creates a table for each item. However, I don't want all 972 items to load on one page. Is there a way to use PHP to set it so that every 10 items, or tables, it creates a new page with the next 10 items, then another page, and another until it hits the last item? I have to present the site to my boss Friday. Any help would be greatly appreciated!

To do pagination with PHP/MySQL, you need to do the following:

  1. Provide the page requested via the URL query string (e.g. ?page=1)
  2. Use LIMIT and OFFSET in your SQL query to show a different "page"
  3. Maintain the ORDER BY portion of your query so the results are in the same order on each page
  4. Optionally have a mechanism for determining what the last page is, and prevent viewing of pages beyond that last page.

To get you on the right track, your code should look something like this:

$limit = 10; // This never changes
$page = $_GET['page'];
if(!$page || !is_numeric($page) || $page < 1) {
    $page = 1;
}
$offset = ($page - 1) * $limit; // Start at record 10 instead of record 0
$results = $my_db_object->getResults("SELECT * FROM equipment ORDER BY id LIMIT $limit OFFSET $offset");