note 71616 added to function.odbc-prepare
| From: | bslorence at osu1 dot php dot net | Date: | Thu, 07 Dec 2006 21:50:54 +0000 |
| Subject: | note 71616 added to function.odbc-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120412@lists.php.net to get a copy of this message | ||
Is it just me or is the code above misleading? It makes it look like odbc_execute() returns a
resource suitable, say, for passing to one of the odbc_fetch_* functions.
In fact, odbc_execute() returns a boolean, which simply indicates success (TRUE) or failure (FALSE).
The variable to pass to odbc_fetch_* is the same one that you pass to odbc_execute():
<?php
$res = odbc_prepare($db_conn, $query_string);
if(!$res) die("could not prepare statement ".$query_string);
if(odbc_execute($res, $parameters)) {
$row = odbc_fetch_array($res);
} else {
// handle error
}
?>
----
Server IP: 216.194.113.175
Probable Submitter: 71.130.64.166
----
Manual Page -- http://www.php.net/manual/en/function.odbc-prepare.php
Edit -- https://master.php.net/note/edit/71616
Del: integrated -- https://master.php.net/note/delete/71616/integrated
Del: useless -- https://master.php.net/note/delete/71616/useless
Del: bad code -- https://master.php.net/note/delete/71616/bad+code
Del: spam -- https://master.php.net/note/delete/71616/spam
Del: non-english -- https://master.php.net/note/delete/71616/non-english
Del: in docs -- https://master.php.net/note/delete/71616/in+docs
Del: other reasons-- https://master.php.net/note/delete/71616
Reject -- https://master.php.net/note/reject/71616
Search -- https://master.php.net/manage/user-notes.php