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: 2021-08-05 11:25 UTC
From: darek334 at gazeta dot pl Assigned: cmb (profile)
Status: Closed Package: MySQLi related
PHP Version: 7.1.3 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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
 [2021-08-05 11:25 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 15:01:27 2025 UTC