#35823 [Opn]: num_results property returns 0 when using prepared statements on MySQL 5.0

From: Date: Tue, 27 Dec 2005 23:01:56 +0000
Subject: #35823 [Opn]: num_results property returns 0 when using prepared statements on MySQL 5.0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91150@lists.php.net to get a copy of this message
 ID:               35823
 User updated by:  carlv at carlsoft dot net
 Reported By:      carlv at carlsoft dot net
 Status:           Open
 Bug Type:         MySQLi related
 Operating System: Windows XP
 PHP Version:      5.1.1
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[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)

« previous php.bugs (#91150) next »