ora_bindDescriptionThis function binds the named PHP variable with a SQL parameter. ora_bind() must be called before ora_exec() but after ora_parse() to bind a SQL statement to a PHP variable, which can then be executed. One benefit of this restriction is that strings are correctly handled, so quoting is not required and stored procedures can also be accessed. The name parameter must be in the form ":name" - note the colon. With the optional type parameter, you can define whether name is for input or output. A value of 1 indicates in, while a value of 2 indicates out. The default is 0, indicating in and out. NoteAs of versions 3.0 and 4.0 NoteAs of PHP 3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN, and ORA_BIND_OUT instead of the numbers for the type parameter. Example// connect if (!$db = ora_logon("dev@ORCL","dev")) { $error = ora_error(); printf("There was an error connecting. Error was: %s", $error); die(); } $curs = ora_open($db); // insert the string into the table $field = "John Smith"; // parse and bind the column value ora_parse($curs, "INSER INTO phone_numbers (name) values (:afield)"); ora_bind($curs, "field", ":afield", 20, ORA_BIND_INOUT); // execute the query ora_exec($curs); // close the cursor ora_close($curs)
PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing
(Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch).
This material may be distributed only subject to the terms and conditions set forth
in the Open Publication License, v1.0 or later (the latest version is presently available at
http://www.opencontent.org/openpub/).
The authors of this book have elected not to choose any options under the OPL. This online book was obtained
from http://www.fooassociates.com/phpfer/
and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4
for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All
persons and entities shall have neither liability nor responsibility to any person or entity with respect to
any loss or damage arising from the information contained in this book.
|