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

(singke) #1

The ora_rollback function performs a rollback on the given connection. Automatic
commits must be turned off first.


Postgres


Postgres was originally developed at the University of California, Berkeley. It introduced
many of the advanced object-relational concepts becoming popular in commercial
databases. PostgreSQL is the most current incarnation of Postgres and is considered to be
version 6. It implements almost all of the SQL specification. Best of all, it's free.


As with other sections in this chapter, the descriptions of the functions can't stand alone.
You will have to study PostgreSQL to fully understand how they work. More information
may be found at the official PostgreSQL Web site at http://www.postgresql.org/.
Zeev Suraski wrote the original Postgres extension. Jouni Ahto added support for large
objects.


boolean pg_close(integer connection)


Use pg_close to close a connection to a PostgreSQL database. See pg_exec for an
example of use.


integer pg_cmdtuples(integer result)


The pg_cmdtuples function returns the number of instances affected by the last query.
This includes DELETE, INSERT, and UPDATE statements, but not SELECT statements.


<?
//connect to database
$Connection = pg_connect("", "", "", "", "leon");


$Query = "INSERT INTO item ";
$Query .= "VALUES ('hammer', 15.00) ";


//execute query
$Result = pg_exec($Connection, $Query);


//tell user how many rows were inserted
print(pg_cmdtuples($Result). " rows inserted.
\n");


//close connection
pg_close($Connection);
?>


integer pg_connect(string connection)


integer pg_connect(string host, string port, string database)

Free download pdf