Thread: PHP VS Oracle
View Single Post
Old June 8th, 2004, 10:35 AM
Daniel Walker Daniel Walker is offline
Friend of Wrox
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts

Well, you'd probably use a DSN like:

$dsn = "oci8://$user:$pass@$host/$db_name";

After that, most of your work would be via the standard procedure calls in DB_common, I'd guess. Something like (Translating the top of your code to DB::PEAR):

$query = "SELECT * FROM item WHERE no = '$no'";
$result = ($db->query($query, $connection)or die($result->getMessage()));
$rows = $result->numRows($result);

//display all entries

    for ( $i=0; $i<$rows; $i++ )
            $row = $result->fetchRow();
...and so on.

That's a strict translation, although saying:

while($row = $result->fetchRow()){

Would do away with having to find out the number of rows and then ahing to use a for loop to go through them all.