ID:               31037
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at trafex dot nl
-Status:           Open
+Status:           Feedback
 Bug Type:         MySQLi related
 Operating System: Fedora core 1
 PHP Version:      5.0.2
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.

Can't reproduce: 
 
<?php 
 
$mysql = new mysqli("localhost", "root", "", "test"); 
 
printf("Client version: %s\n", $mysql->client_version); 
printf("Server version: %s\n", $mysql->server_version); 
 
$mysql->query("DROP TABLE IF EXISTS pm_users"); 
 
$mysql->query("CREATE TABLE pm_users(username varchar(20), 
user_id int)"); 
$mysql->query("INSERT INTO pm_users VALUES ('foo', 1)"); 
 
if ($stmt = $mysql->prepare("SELECT username FROM pm_users 
WHERE user_id = ?")) 
{ 
    $stmt->bind_param('i', $user_id); 
    $user_id = 1; 
  
    $stmt->execute(); 
         
    $stmt->bind_result($name); 
    $stmt->fetch(); 
 
    printf("Name: %s\n", $name); 
    $stmt->close(); 
} 
 
$mysql->close(); 
?> 
 
 
Output: 
Client version: 40108 
Server version: 40108 
Name: foo 


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

[2004-12-09 11:14:03] php at trafex dot nl

Description:
------------
I was trying to execute the code that you see below.
But i got the error 
"Warning: mysqli_stmt::bind_param() [function.bind-param]: Number of
variables doesn't match number of parameters in prepared statement
in..."

So i've tried everything, but still got the same error.

I think this is a bug, and i hope it can be fixed.

I've tried the code with PHP 5.0.2 and PHP 5.0.3 RC1
But still got the same error.

For more info please mail me, thanx!

Reproduce code:
---------------
/* create a prepared statement */
$stmt = $mysqli->prepare("SELECT username FROM pm_users WHERE user_id =
?")

   /* bind parameters for markers */
   $stmt->bind_param('i', $user_id);

    $user_id = 1;

   /* execute query */
   $stmt->execute();


Expected result:
----------------
Nothing at the moment, just NO error.

Actual result:
--------------
Warning: mysqli_stmt::bind_param() [function.bind-param]: Number of
variables doesn't match number of parameters in prepared statement in
/home/projects/pacman/_public_html/test.php on line 16


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


-- 
Edit this bug report at http://bugs.php.net/?id=31037&edit=1

Reply via email to