Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Oracle's connectivity with PHP problem

Shahab KhanOct 6 2009 — edited Oct 7 2009
Dear community memeber;

I am totaly new in php. I have no know much knowledge about it; please help me about connectivity with oracel 10g.

I have written script for connectivity as:

<?php
echo 'This is my first page.';
$db = "(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = BEQ-LOCAL.WORLD)))" ;
if ($c=OCI_NEW_CONNECT('pcs','pcs',$db)) {
echo “Successfully connected to Oracle.\n”;
OCILogoff($c);
} else {
$err = OCIError();
echo “Connection failed.” . $err[text];
}
?>

when I run it; I face the error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\test.php on line 6.

and when I run this script:

<?php

$c = oci_new_connect('pcs', 'pcs', 'ORCL');
$s = oci_parse($c, 'select first_name from employee');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
echo $res['FIRST_NAME'] . "<br>";
}

echo "This is a testing page.";
?>

Error shows:

Fatal error: Call to undefined function oci_new_connect() in C:\xampp\htdocs\ss.php on line 3


Please help me about connectivity.

Thanks in advance.

Shahab Ahmed Khan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2009
Added on Oct 6 2009
2 comments
4,024 views