From: lmanseau at claurendeau dot qc dot ca
Operating system: Linux
PHP version: 5.2.4
PHP Bug Type: MySQLi related
Bug description: Problem with prepared statement
Description:
------------
I try to execute a prepared statement with mysqli. I use PHP 5.2.0 with
MySQL 5.0.27
After some tests, prepared statements with MySQL instructions such as
(INSERT, DELETE and UPDATE) work very well.
The only case problem which I pointed out, it is the instruction SELECT
that does not seem to react of good manner
- SELECT * FROM table1 dont work
- SELECT C1, C2 FROM table1 - dont work
I have no error message!!!
Reproduce code:
---------------
$db = new mysqli($hote, $util, $mpas, $base);
if (!$db) {
echo "No connection with BD";
exit();
}
//WORK WELL
echo 'Non prepared statement<br />';
$sql = "select * from ch9books";
$rqp = $db->query($sql);
echo 'books = '.$rqp->num_rows.'<br />';
//DONT WORK
echo '<br />Prepared statement<br />';
$sql = "select * from ch9books";
$rqp = $db->prepare($sql);
$rqp->execute();
echo 'books = '.$rqp->num_rows.'<br />';
$rqp->close();
Expected result:
----------------
Non prepared statement
Books = 6
Actual result:
--------------
Prepared statement
Books = 0
--
Edit bug report at http://bugs.php.net/?id=42619&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42619&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42619&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42619&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42619&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42619&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42619&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42619&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42619&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42619&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42619&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42619&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42619&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42619&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42619&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42619&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42619&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42619&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42619&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42619&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42619&r=mysqlcfg