P. 1
phpyoracle

phpyoracle

|Views: 623|Likes:
Published by Dunkel Kruspe

More info:

Categories:Types, Research
Published by: Dunkel Kruspe on Apr 05, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/03/2011

pdf

text

original

Fetching as objects allows property-style access to be used.

$s = oci_parse($c, 'select * from locations');
oci_execute($s);
while ($row = oci_fetch_object($s)) {
var_dump($row);

}

This shows each row is an object and gives its properties. The var_dump() function prints and
automatically formats the variable $row. This function is commonly used for debugging PHP scripts. The
output is:

object(stdClass)#1 (6) {
["LOCATION_ID"]=>
string(4) "1000"
["STREET_ADDRESS"]=>
string(20) "1297 Via Cola di Rie"
["POSTAL_CODE"]=>
string(5) "00989"
["CITY"]=>
string(4) "Roma"
["STATE_PROVINCE"]=>
NULL
["COUNTRY_ID"]=>
string(2) "IT"

}
. . .

If the loop is changed to:

while ($row = oci_fetch_object($s)) {
echo "Address is " . $row->STREET_ADDRESS . "
\n";

}

the output is:

Address is 1297 Via Cola di Rie
Address is 93091 Calle della Testa

130

Fetch Functions

Address is 2017 Shinjuku-ku
Address is 9450 Kamiya-cho
Address is 2014 Jabberwocky Rd
. . .

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->