What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



ora_bind — Binds a PHP variable to an Oracle parameter.


bool ora_bind(cursor, variable, name, length[, type]);
resource cursor: Cursor handle
string variable: PHP variable name
string name: SQL Parameter
int length: Length
int type (optional): Type


TRUE on success; FALSE on failure


This 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.


As of versions 3.0 and 4.0


As 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 876. Example

// connect
if (!$db = ora_logon("dev@ORCL","dev")) {
   $error = ora_error();
   printf("There was an error connecting. Error was: %s", $error);

$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

// close the cursor

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 The authors of this book have elected not to choose any options under the OPL. This online book was obtained from 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.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.