A basic query in OCI8 : Oracle : Databases PHP Source Code


PHP Source Code » Databases » Oracle »

 

A basic query in OCI8


In PHP, single and double quotes are used for strings. Strings with embedded quotes can be
made by escaping the nested quotes with a backslash, or by using both quoting styles. The
next example shows single quotes around the city name. To make the query a PHP string, it is
fully enclosed in double quotes:
$s = oci_parse($c,
"select * from locations where city = 'Sydney'");
<?php
$c 
oci_connect("hr""hrpwd""//localhost/XE");
$s oci_parse($c'select city, postal_code from locations');
oci_execute($s);
print 
'<table border="1">';
while (
$row oci_fetch_array($sOCI_RETURN_NULLS)) {
print 
'<tr>';
foreach (
$row as $item)
print 
'<td>'.$item.'</td>';
print 
'</tr>';
}
print 
'</table>';
oci_close($c);
?>


HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Databases
» Oracle