note 47966 added to function.mysqli-stmt-prepare

From: Date: Tue, 07 Dec 2004 13:35:56 +0000
Subject: note 47966 added to function.mysqli-stmt-prepare
Groups: php.notes 
Request: Send a blank email to php-notes+get-81488@lists.php.net to get a copy of this message
Hi, the procedural sample is wrong. mysqli_stmt_prepare(...) returns a boolean value. In the sample the statement returned from mysqli_stmt_init(...) is passed as first value and used as return value. As return value it's set to true what in further calls leads to the warning: Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given Sample must hence look like: $stmt = mysqli_stmt_init($conn); if (TRUE==mysqli_stmt_prepare($stmt, "SELECT District FROM City WHERE Name=?")) { Best, Bernhard ---- Manual Page -- http://www.php.net/manual/en/function.mysqli-stmt-prepare.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47966 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47966&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47966&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81488) next »