1

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

1 Answer 1

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

oci_execute($array);

while($row=oci_fetch_array($array))

{

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

}
Sign up to request clarification or add additional context in comments.

1 Comment

i have error msg: Successfully connected to Oracle. Warning: oci_parse() expects parameter 1 to be resource, null given in C:\wamp\www\temp\example2\x.php on line 11 Warning: oci_execute() expects parameter 1 to be resource, null given in C:\wamp\www\temp\example2\x.php on line 13 Notice: Undefined variable: stid in C:\wamp\www\temp\example2\x.php on line 15 Warning: oci_fetch_array() expects parameter 1 to be resource, null given in C:\wamp\www\temp\example2\x.php on line 15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.