Doc #74262 [Com]: mysqli_stmt::$num_rows docs should explain more about USEd vs. STOREd resultsets
| From: | darek334 at gazeta dot pl | Date: | Fri, 17 Mar 2017 20:03:14 +0000 |
| Subject: | Doc #74262 [Com]: mysqli_stmt::$num_rows docs should explain more about USEd vs. STOREd resultsets | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14516@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74262&edit=1
ID: 74262
Comment by: darek334 at gazeta dot pl
Reported by: darek334 at gazeta dot pl
Summary: mysqli_stmt::$num_rows docs should explain more
about USEd vs. STOREd resultsets
Status: Verified
Type: Documentation Problem
Package: MySQLi related
Operating System: linux
PHP Version: 7.1.3
Block user comment: N
Private report: N
New Comment:
Like as I see, There is some others method internal storing of data, one available for code and
other hide. Sense of manual is different.
Previous Comments:
------------------------------------------------------------------------
[2017-03-17 19:27:02] requinix@php.net
$num_rows is only available after all results have been fetched - MySQL does not send that
information separately. STORE'd results are buffered internally so $num_rows works immediately
but USE'd results are not buffered.
If you want $num_rows before fetching then you need to use MYSQLI_STORE_RESULT or call
mysqli_stmt::store_result().
The documentation only gives a brief mention of this, though there is a user comment that explains
it in more detail.
http://php.net/manual/en/mysqli-stmt.num-rows.php#71988
------------------------------------------------------------------------
[2017-03-17 13:26:08] darek334 at gazeta dot pl
Description:
------------
MYSQLI_USE_RESULT with SHOW TABLES query don't show any rows in num_rows.
mysqli_result->close() - don't help
Test script:
---------------
$query = 'SHOW TABLES LIKE "'.$table.'"',MYSQLI_USE_RESULT
$query->num_rows //- shows always 0
Expected result:
----------------
1 or higher
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74262&edit=1