#42619 [Opn->Fbk]: Problem with prepared statement

From: Date: Tue, 11 Sep 2007 11:50:15 +0000
Subject: #42619 [Opn->Fbk]: Problem with prepared statement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117389@lists.php.net to get a copy of this message
 ID:               42619
 Updated by:       jani@php.net
 Reported By:      lmanseau at claurendeau dot qc dot ca
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Linux
 PHP Version:      5.2.4


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

[2007-09-11 08:52:29] uwendel at mysql dot com

Please provide a reproducible test case, including SQL definitions and
"the other statements" you mention, if they are needed for a minimum
test case.

Thanks!

------------------------------------------------------------------------

[2007-09-10 20:50:48] lmanseau at claurendeau dot qc dot ca

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 – don’t work
-	SELECT C1, C2 FROM table1 - don’t 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 />'; 


//DON’T 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 this bug report at http://bugs.php.net/?id=42619&edit=1


Thread (6 messages)

« previous php.bugs (#117389) next »