#29530 [Opn->Bgs]: mysqli->prepare() Error (00000/1047)
| From: | georg@php.net | Date: | Thu, 05 Aug 2004 10:18:05 +0000 |
| Subject: | #29530 [Opn->Bgs]: mysqli->prepare() Error (00000/1047) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-64122@lists.php.net to get a copy of this message | ||
ID: 29530
Updated by: georg@php.net
Reported By: chenxi at shine dot com dot cn
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Redhat Linux 9
PHP Version: 5.0.0
New Comment:
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
Please note the difference between procedural and OO:
$mysql->prepare("SELECT .....")
this is a method, you don't have to specify an object
mysqli_prepare($mysql, "SELECT ...")
this is a procedural function, where you have to specify
the object.
Previous Comments:
------------------------------------------------------------------------
[2004-08-05 11:51:32] chenxi at shine dot com dot cn
i make a mistake:
$stmt = $mysqli->prepare("SELECT id, name FROM program")
------------------------------------------------------------------------
[2004-08-05 11:50:07] chenxi at shine dot com dot cn
Description:
------------
give me following error message:
Warning: mysqli_prepare() [function.mysqli-prepare]: Error
(00000/1047): Unknown command in /shine/htdocs/test.php on line 16
Reproduce code:
---------------
$mysqli = new mysqli("localhost", "root", "root", "hotel");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare($link, "SELECT id, name FROM program")) {
$stmt->execute();
$stmt->bind_result($col1, $col2);
while ($stmt->fetch()) {
printf("%i %s\n", $col1, $col2);
}
$stmt->close();
} else {
print "stmt failed<br/>";
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29530&edit=1