<?
/*
Source code example for Web Database Applications
Unless otherwise stated, the source code distributed with this book can be
redistributed in source or binary form so long as an acknowledgment appears
in derived source files.
The citation should list that the code comes from Hugh E.
Williams and David Lane, "Web Database Application with PHP and MySQL"
published by O'Reilly & Associates.
This code is under copyright and cannot be included in any other book,
publication, or educational product without permission from O'Reilly &
Associates.
No warranty is attached; we cannot take responsibility for errors or fitness
for use.
*/
?>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Wines</title>
</head>
<body><pre>
<?php
// (1) Open the database connections
$connection = OCILogon("fred","shhh");
// (2) Setup the query on the winestore through the
// connection
$query = OCIParse($connection, "select * from
wine");
// (3) Run the query
OCIExecute($query);
// (4) Output the results
while (OCIFetch($query))
{
// (5) Print out the attributes in this row
for($x=1;$x<=OCINumCols($query);$x++)
echo OCIResult($query,$x);
echo "\n";
}
// (6) Close the database connection
OCILogoff($connection);
?>
</pre>
</body>
</html>