From: lucas at maurobenevides dot com dot br
Operating system: Windows 2000
PHP version: 5.0.1
PHP Bug Type: MySQL related
Bug description: mysqli prepare() does not work
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
--
Edit bug report at http://bugs.php.net/?id=29905&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29905&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29905&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29905&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29905&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29905&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29905&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29905&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29905&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29905&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29905&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29905&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29905&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29905&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29905&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29905&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29905&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29905&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29905&r=float