ocibindbynameDescriptionBind a PHP variable specified by variable to an Oracle placeholder by name . The length parameter sets the maximum length for the bind. If length is defined as -1, the function will use the current length of variable to set the maximum length. When attempting to bind an abstract datatype such as a BFILE, LOB or ROWID it must be allocated first using ocinewdescriptor() and length should be set to -1. type specifies what kind of descriptor is to be used. Possible values are: OCI_B_FILE (Binary-File), OCI_B_CFILE (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and OCI_B_ROWID (ROWID). ExampleExample 848. Insert using bound columns if (!$db = @ocinlogon("dev","dev", "ORCL")) { $error = ocierror(); printf("There was an error connecting. Error was: %s", $error["message"]); die(); } $data = array("bob@x.com" => "12345", "john@y.com" => "67890"); $stmt = ociparse($db,"INSERT INTO phone_numbers (EMAIL, PHONE_NUMBER) VALUES (:email,:phone)"); ocibindbyname($stmt,":email",$email,100); ocibindbyname($stmt,":phone", $phone, 20); while (list($email,$phone) = each($data)) { ociexecute($stmt); }
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.
|