Tharindu
Tharindu

Reputation: 197

How to SELECT data from Oracle database using PHP

How do I fetch the EMPNO and ENAME columns from the table called emp?

This is my connection string:

if ($c = oci_connect("tharindu", "123456", "localhost/XE")) {  
   echo "Successfully connected to Oracle.";   
   oci_close($c);
} else {  
   $err = oci_error();   
   echo "Oracle Connect Error " . $err['text'];
}

Upvotes: 1

Views: 31215

Answers (1)

Rasel
Rasel

Reputation: 15477

$array = oci_parse($c, "SELECT EMPNO,ENAME
                            FROM emp");

oci_execute($array);

while($row=oci_fetch_array($array))

{

echo $row[0]." ".$row[1];

}

Upvotes: 4

Related Questions