ID: 31037 Updated by: [EMAIL PROTECTED] Reported By: php at trafex dot nl -Status: Assigned +Status: Feedback Bug Type: MySQLi related Operating System: Fedora core 1 -PHP Version: 5CVS-2005-03-05 +PHP Version: 5CVS-2005-04-26 Assigned To: georg New Comment:
Cannot reproduce with different combinations of client and server API as well as PHP versions [EMAIL PROTECTED]:~/test> php 31037.php Client version: 50004 Server version: 40112 Name: foo [EMAIL PROTECTED]:~/test> php 31037.php Client version: 50004 Server version: 40110 Name: foo [EMAIL PROTECTED]:~/test> php 31037.php Client version: 40110 Server version: 40110 Name: foo Did you recompile PHP with 4.1.10 library or it is still using 4.1.7? Previous Comments: ------------------------------------------------------------------------ [2005-03-06 18:26:47] [EMAIL PROTECTED] Assigning to the maintainer.. ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31037 -- Edit this bug report at http://bugs.php.net/?id=31037&edit=1
