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

From: Date: Tue, 27 Dec 2005 23:00:00 +0000
Subject: #35823 [NEW]: num_results property returns 0 when using prepared statements on MySQL 5.0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91149@lists.php.net to get a copy of this message
From:             carlv at carlsoft dot net
Operating system: Windows XP
PHP version:      5.1.1
PHP Bug Type:     MySQLi related
Bug description:  num_results property returns 0 when using prepared statements on MySQL 5.0

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 bug report at http://bugs.php.net/?id=35823&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35823&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35823&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35823&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35823&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35823&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35823&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35823&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35823&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35823&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35823&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35823&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35823&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35823&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35823&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35823&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35823&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35823&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35823&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35823&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35823&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#91149) next »