|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37839 Limit of returned rows
Submitted: 2006-06-18 17:17 UTC Modified: 2013-05-31 05:18 UTC
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:5 (83.3%)
Same OS:2 (33.3%)
From: rael at grad dot icmc dot usp dot br Assigned:
Status: Wont fix Package: PDO related
PHP Version: 5.1.4 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: rael at grad dot icmc dot usp dot br
New email:
PHP Version: OS:


 [2006-06-18 17:17 UTC] rael at grad dot icmc dot usp dot br
A PDO method for limit the number of rows returned from a query, independent of the used DBMS. This feature is available in DBMS abstraction packages, like ADODB (and in Java JDBC too). Something like this:

function setLimit($limit, $offset);

Reproduce code:
$con = new PDO('mysql:host=localhost;dbname=test', $user, $pass);

$stmt = $con->prepare("SELECT * FROM table");
$stmt->setLimit(10, 2);

Expected result:
10 tableresults starting from position 2

Actual result:
Function not exists yet.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:51 UTC]
-Package: Feature/Change Request +Package: PDO related
 [2011-12-24 06:33 UTC]
This same effect is achievable using the fetch method with the offset argument and limiting the results in your fetch loop.

It could be argued the offset and limit arguments should be added to the fetchAll() method though.
 [2013-05-31 05:18 UTC]
-Status: Open +Status: Wont fix
 [2013-05-31 05:18 UTC]
This is easily emulated using the existing fetch() function.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jun 24 02:01:24 2021 UTC