Database Articles

  Home arrow Database Articles arrow Page 2 - PHP - Previous and Next Links
DATABASE ARTICLES

PHP - Previous and Next Links
By: Matt Wade
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 12
    2002-02-04

    Table of Contents:
  • PHP - Previous and Next Links
  • The LIMIT Clause
  • Starting Off with $start
  • Building the Previous and Next Links
  • Putting It All Together

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    PHP - Previous and Next Links - The LIMIT Clause


    (Page 2 of 5 )

    The LIMIT clause of the SQL SELECT statement is going to be our bread and butter here. It is how we are going to retrieve the exact rows that we want from the database.

    LIMIT takes either one or two arguments. With one argument, it limits the amount of returned rows by that number.

    SELECT * FROM table LIMIT 5

    The proceeding SQL statement returns the first 5 rows of the table. If we use LIMIT with two arguments, the first argument specifies what row to start on and the second is how many rows to return. Note that rows in SQL start with 0 (zero), not 1 (one).

    SELECT * FROM table LIMIT 5, 5

    That last SQL statement will return rows 6 through 10 from the database.

    The LIMIT clause is not difficult, but it is imperative that you understand how it works in order to accomplish our goal.

    More Database Articles Articles
    More By Matt Wade

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap