php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74262 mysqli_stmt::$num_rows docs should explain more about USEd vs. STOREd resultsets
Submitted: 2017-03-17 13:26 UTC Modified: 2017-03-17 19:27 UTC
From: darek334 at gazeta dot pl Assigned:
Status: Verified Package: MySQLi related
PHP Version: 7.1.3 OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: darek334 at gazeta dot pl
New email:
PHP Version: OS:

 

 [2017-03-17 13:26 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-17 13:53 UTC] adambaratz@php.net
-Package: *General Issues +Package: MySQLi related
 [2017-03-17 19:27 UTC] requinix@php.net
-Summary: MYSQLI_USE_RESULT with SHOW TABLES +Summary: mysqli_stmt::$num_rows docs should explain more about USEd vs. STOREd resultsets -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2017-03-17 19:27 UTC] 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 20:03 UTC] darek334 at gazeta dot pl
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.
 [2017-03-17 20:08 UTC] darek334 at gazeta dot pl
Especially more info here :
http://php.net/manual/en/mysqli.query.php
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 12:01:24 2019 UTC