php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35823 num_results property returns 0 when using prepared statements on MySQL 5.0
Submitted: 2005-12-27 23:59 UTC Modified: 2005-12-28 12:14 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: carlv at carlsoft dot net Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.1 OS: Windows XP
Private report: No CVE-ID: None
 [2005-12-27 23:59 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-28 00:01 UTC] 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-28 11:57 UTC] 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 12:14 UTC] georg@php.net
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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 02:01:29 2024 UTC