ID:               31037
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at trafex dot nl
-Status:           Open
+Status:           Assigned
 Bug Type:         MySQLi related
 Operating System: Fedora core 1
-PHP Version:      5.0.4
+PHP Version:      5CVS-2005-03-05
-Assigned To:      
+Assigned To:      georg
 New Comment:

Assigning to the maintainer..



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

[2005-03-04 17:06:10] php at trafex dot nl

I've tested it again with the these versions:
- PHP version 5.04-cvs (snapshot of 4 march 05)
- MySQL version 4.1.10

And again the same error.

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

[2005-02-04 16:25:27] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Please also upgrade your mysql server and client library 
to 4.1.9 

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

[2004-12-09 12:20:36] php at trafex dot nl

Oke i've edited the script you gave for my database.
This script do i use now:

Code:
----------------------------------------
<?php 
 
$mysql = new mysqli("localhost", "****", "****", "test");
 
printf("Client version: %s\n", $mysql->client_version); 
printf("Server version: %s\n", $mysql->server_version); 
 
$mysql->query("DROP TABLE IF EXISTS temp_table"); 
 
$mysql->query("CREATE TABLE temp_table(username varchar(20), user_id
int)"); 
$mysql->query("INSERT INTO temp_table VALUES ('foo', 1)"); 
 
if ($stmt = $mysql->prepare("SELECT username FROM temp_table 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(); 
?>
----------------------------------------


This script outputs:
----------------------------------------
Client version: 40107 Server version: 40107
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
Name:

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

A online example can you find here:
http://testing.4worx.com/test.php

And the phpinfo() here:
http://testing.4worx.com/phpinfo.php

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

[2004-12-09 12:08:50] [EMAIL PROTECTED]

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 

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

[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