Solved

limiting rows

Posted on 2004-04-18
6
272 Views
Last Modified: 2008-03-06
how can i limit rows while getting result from database?
0
Comment
Question by:abhishek2002
6 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 50 total points
ID: 10853363
The LIMIT clause may be used to limit the records returned by the SELECT statement. You specify the start row (start from zero), and the number of records returned. The following example lists the first 10 records from the search table.

SELECT * FROM search LIMIT 0, 10;

The following example would retrieve the next ten records from the table.
SELECT * FROM search LIMIT 10, 10;  
0
 
LVL 1

Expert Comment

by:drag0n
ID: 10855791
You can also store the start and end rows in variables to be able to produce the paging functions you see everywhere. You pass these variables in the url with strings for next, previous paging
0
 
LVL 7

Expert Comment

by:madwax
ID: 10867000
Repost from duplicate question:

Hi abhishek2002,

If you are using MySQL you can write

SELECT * FROM myTable LIMIT 0,10

where 0 is startrow and 10 is number of records you want to return

Read more: http://dev.mysql.com/doc/mysql/en/SELECT.html

//jan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now