Solved

limiting rows

Posted on 2004-04-18
6
267 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 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

18 Experts available now in Live!

Get 1:1 Help Now