Connecting using PDO

hii all,
I am new to PHP, Ive found resources for PHP with MySQl as backend, but i am forced to use Oracle. So how do i connect using pdo? How do i insert rows and query and get back the data?
heres the code for connection which failed to connect…

try {
$dbh = new PDO(‘oci:dbname=cfapps’, ‘mailservices’, ‘msUser48’);
}
catch (PDOException $e) {
trigger_error("Could not connect to database: ". $e->getMessage(), E_USER_ERROR);
}

Thank you in advance.

Welcome to Sitepoint sindhu88. :slight_smile:

PDO doesn’t currently have a stable driver, try the oci_* family of functions instead.

@anthony
Thanks for the info. I have tried oci connect and it worked out well. I am able to insert the data and store it into the database.
I have to query the data, for instance on the UI, if I give the emp_id, I have to get that record details.

<?php
$objConnect = oci_connect(“mailservices”, “msUser48”, cfapps);
$strSQL.=“insert into emp”;
$strSQL.=“(empname,empid)”;
$strSQL.=“values”;
$strSQL.=“('”.$_POST[“emp”].“‘,’”.$_POST[“empid”].“')”;
$objParse = oci_parse($objConnect, $strSQL);
$objExecute = oci_execute($objParse, OCI_DEFAULT);
if($objExecute)
{
oci_commit($objConnect); //*** Commit Transaction ***//
echo “Save completed.”;
}
oci_close($objConnect);

This is my code, can anyone guide me?
Thanks in advance…

That code saves a record, what code do you have to retrieve one? Have you tried to modify the examples listed on the manual ?