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

From: Date: Fri, 02 Sep 2011 22:11:44 +0000
Subject: Doc #54704 [Fbk->Opn]: mysql_num_rows() does work with mysql_unbuffered_query()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7115@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 User updated by: juangiordana at gmail dot com Reported by: juangiordana at gmail dot com Summary: mysql_num_rows() does work with mysql_unbuffered_query() -Status: Feedback +Status: Open Type: Documentation Problem Package: Documentation problem PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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 (#7115) next »