php.net |  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
Votes:6
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-06-18 17:17 UTC] rael at grad dot icmc dot usp dot br
Description:
------------
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:51 UTC] jani@php.net
-Package: Feature/Change Request +Package: PDO related
 [2011-12-24 06:33 UTC] ssufficool@php.net
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] ssufficool@php.net
-Status: Open +Status: Wont fix
 [2013-05-31 05:18 UTC] ssufficool@php.net
This is easily emulated using the existing fetch() function.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 23:01:25 2019 UTC