php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29905 mysqli prepare() does not work
Submitted: 2004-08-31 06:36 UTC Modified: 2004-08-31 07:44 UTC
From: lucas at maurobenevides dot com dot br Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2004-08-31 06:36 UTC] lucas at maurobenevides dot com dot br
Description:
------------
I could not use Prepared Statement in my program. Any query I use within $mysqli->prepare() returns a null variable. When I print the $mysqli->error it prints out "Unknown command"
I am pretty sure it is not the query string, because the same Query I use with the query() (without prepare) statement and it works fine.

I haven't changed my php.ini, except by uncommenting the line extension=php_mysql.dll and adding the line: 
extension=php_mysqli.dll

Please, Test it in the Windows 2000
I use Mysql 4.0.2


Reproduce code:
---------------
$conn = new mysqli(HOST_MYSQL, USER_MYSQL, PASSWD_MYSQL, DBNAME_MYSQL);
	if (mysqli_connect_errno()) {
	    printf("Connect failed: %s\n", mysqli_connect_error());
	    exit();
	}
	$consulta = $conn->prepare("SELECT MD5_PASSWORD FROM tb_user WHERE TXT_LOGIN=?" );
 	if (!$consulta) 
 		printf($conn->error);
        $consulta->bind_param("s", $_POST["password"]);
	$result = $consulta->fetch();


Expected result:
----------------
Unknown command
Fatal error: Call to a member function fetch() on a non-object in C:mydir on line 17



Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-31 07:44 UTC] georg@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

ext/mysqli doesn't work with MySQL 4.0.x. You need MySQL 
>= 4.1.3. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 15 21:01:28 2024 UTC