Doc #54704 [Opn->Csd]: mysql_num_rows() does work with mysql_unbuffered_query()

From: Date: Mon, 05 Dec 2011 21:55:37 +0000
Subject: Doc #54704 [Opn->Csd]: mysql_num_rows() does work with mysql_unbuffered_query()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7588@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54704&edit=1 ID: 54704 Updated by: frozenfire@php.net Reported by: juangiordana at gmail dot com Summary: mysql_num_rows() does work with mysql_unbuffered_query() -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: 5.3.6 -Assigned To: +Assigned To: frozenfire Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2011-12-05 21:55:23] frozenfire@php.net Automatic comment from SVN on behalf of frozenfire Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=320465 Log: Clarified that certain commands can be used on a result set from mysql_unbuffered_query after all rows have been fetched. Closes bug #54704. ------------------------------------------------------------------------ [2011-09-02 22:11:44] juangiordana at gmail dot com Hello, The report is about a documenation problem. The documentation for mysql_unbuffered_query() says that "you **cannot** use mysql_num_rows()", but you ***can*** use it, as stated in the manual page of mysql_num_rows(), once you retrived all the rows from the result set. ------------------------------------------------------------------------ [2011-09-02 13:35:05] uw@php.net Automatic comment from SVN on behalf of uw Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=316038 Log: Coverage for bug#54704, of which I think it is bogus, thus no dedicated test. ------------------------------------------------------------------------ [2011-09-02 13:34:38] uw@php.net I am not sure what you are saying here. Are you saying it is a bug in ext/mysql ? It is filed as a documentation problem but the documentation is correct here. I cannot reproduce any issues with mysql_num_rows() and mysql_unbuffered_query(). Please, provide a full example including table structure, table data loading and information on how you compiled PHP (with mysqlnd or libmysql support, if libmysql, which version). ------------------------------------------------------------------------ [2011-05-11 00:38:04] juangiordana at gmail dot com Description: ------------ mysql_num_rows() does work with mysql_unbuffered_query() if all the rows in the result have been retrieved. --- From manual page: http://www.php.net/function.mysql-unbuffered-query#Notes --- "you cannot use mysql_num_rows() and mysql_data_seek() on a result set returned from mysql_unbuffered_query()" --- From manual page: http://www.php.net/function.mysql-num-rows#Notes --- "If you use mysql_unbuffered_query(), mysql_num_rows() will not return the correct value until all the rows in the result set have been retrieved." Test script: --------------- <?php $sql = 'SELECT id FROM table'; $result = mysql_query($sql); echo mysql_num_rows($result) . " results from buffered query.\n"; mysql_free_result($result); $sql = 'SELECT id FROM table'; $result = mysql_unbuffered_query($sql); echo mysql_num_rows($result) . " results from unfinished unbuffered query.\n"; while ($row = mysql_fetch_assoc($result)) { // } echo mysql_num_rows($result) . " results from finished unbuffered query.\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54704&edit=1

« previous php.doc.bugs (#7588) next »