Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

// put everything on sale
$Query = "UPDATE catalog ";
$Query .= "SET price = price * 0.9 ";
$Result = odbc_do($Connection, $Query);


// rollback
odbc_rollback($Connection);


odbc_close($Connection);
?>


integer odbc_setoption(integer id, integer function, integer
option, integer parameter)


The odbc_setoption function changes the configuration of the ODBC driver for an
entire connection or a single result set. Its purpose is to allow access to any ODBC setting
in order to avoid problems with buggy ODBC drivers. To use this function, you ought to
understand ODBC in greater detail than the average user. You will need to know the
values of the various options available to you.


The id argument is either a connection identifier or a result set identifier. Since
odbc_setoption wraps two C API functions, SQLSetConnectOption and
SQLSetStmtOption, you must specify which to use with the function argument. The
option argument is an integer that identifies one of the many options available on the
ODBC driver. The parameter argument is the value to use with the option.


Oracle


Oracle is one of the most popular relational databases in the world. It is an industrial-
strength engine preferred by large corporations using databases of exceeding complexity.
Oracle database administrators are scarce and command high salaries. A full explanation
of working with Oracle is far beyond the scope of this text. Fortunately you will find
many books about Oracle for sale, as well as free documentation on the Oracle Web site.
In particular, I recommend Oracle Call Interface Programmer's Guide, which exists in
several versions. I found it at the following URL http://technet.oracle.
com/doc/server.804/a58234/toc.htm
. This document describes the Oracle Call
Interface which PHP uses.


PHP supports two generations of Oracle libraries, Version 7 and Version 8. The functions
that use Oracle 7 begin with ora_, such as ora_logon. The functions that work with
Oracle 8 begin with oci, such as ocilogon. The Oracle 8 library supports connecting to
older Oracle databases. I've included descriptions of the older functions because it's
possible you're in the situation of not having access to the newer libraries. Aside from
compiling Oracle support into PHP, you may also load an extension using the dl
function.

Free download pdf