如何使用PHP从Oracle数据库中选择数据

时间:2011-05-11 03:55:12

标签: php sql oracle

如何从名为EMPNO的表格中提取ENAMEemp列?

这是我的连接字符串:

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'];
}

1 个答案:

答案 0 :(得分:3)

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

oci_execute($array);

while($row=oci_fetch_array($array))

{

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

}