|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38150 Please add row tell and seek for mysqli
Submitted: 2006-07-19 19:06 UTC Modified: 2017-04-13 13:38 UTC
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: php at adaniels dot nl Assigned: mysql (profile)
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.4 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
12 + 15 = ?
Subscribe to this entry?

 [2006-07-19 19:06 UTC] php at adaniels dot nl
The mysql API functions mysql_row_tell and mysql_row_seek are not ported to the mysqli libary.
I believe this is a shame, because currently it isn't possible to create a function which uses a mysql_result but does not influence the code outside of the function.

I do not see the fact that, mysqli_row_seek would return a resource and not an actual rownumber, as a problem.

P.S. If it is generaly agreed that this is a usefull feature, but there are no volenteers to add the function, I volenteer myself.

Reproduce code:
I would like to do the following:

function get_all_rows(mysqli_result $result)
   $ptr = $result->row_tell();
   $rows = array();
   while ($row = $result->fetch_row()) $rows[] = $row;
   return $rows;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-19 19:13 UTC] php at adaniels dot nl
I mean:

function get_all_rows(mysqli_result $result)
   $ptr = $result->row_tell();
   $rows = array();
   while ($row = $result->fetch_row()) $rows[] = $row;
   return $rows;
 [2011-01-01 23:40 UTC]
-Package: Feature/Change Request +Package: MySQLi related
 [2011-01-06 15:03 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2011-01-06 15:03 UTC]
That's for buffered results only. I don't see a big win considering the iterator support added rather recently (but not properly documented).

Johannes, what's your take?
 [2011-01-16 01:18 UTC]
From a "features complete" standpoint, I do not see why not add it, as it can achieve some flexibility that a developer might need over the iterator and vice versa.
 [2017-04-13 13:38 UTC]
-Status: Assigned +Status: Not a bug
 [2017-04-13 13:38 UTC]
For seeking one has to buffer. Buffering in an array is most efficient as we can make use of PHP's copy-on-write. Thus using fetch_all and then using the array is the best.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 28 23:01:28 2024 UTC