#35823 [Fbk->Bgs]: num_results property returns 0 when using prepared statements on MySQL 5.0
ID: 35823
Updated by: georg@php.net
Reported By: carlv at carlsoft dot net
-Status: Feedback
+Status: Bogus
Bug Type: MySQLi related
Operating System: Windows XP
PHP Version: 5.1.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-12-28 11:57:29] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2005-12-28 00:01:55] carlv at carlsoft dot net
Sorry, my reproduction code contains a bug (left over when I was taking
out unnecessary code). Bind result should only have $m_cur_start in it.
But you get the idea.
------------------------------------------------------------------------
[2005-12-27 23:59:59] carlv at carlsoft dot net
Description:
------------
When using a prepared statement, the num_results will return 0 even if
a result is returned. I am using PHP 5.1 with MySQL 5.
Reproduce code:
---------------
$stmt = $mysql->prepare('
SELECT
cur_start
FROM
track
WHERE
id = ?
;');
$stmt->bind_param('i',$_GET['id']);
$stmt->execute();
$stmt->bind_result($m_id,$m_cur_start);
$stmt->fetch();
// a value is printed out here clearly indicating that a row is
returned
print $m_cur_start;
if ($stmt->num_rows != 1) // this is always 0!
{
Expected result:
----------------
$stmt->num_rows should be 1, in this case.
Actual result:
--------------
$stmt->num_rows is always 0.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35823&edit=1
Thread (4 messages)