Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can't get a value in my $variable
On Sun, 09 Apr 2006 16:42:48 +0200, Dave wrote:
> Hello everyone,
>
> I am trying to get the result of a query in a php variable
> I wander what's wrong with this code because I don't get a value in $val, I
> am sure my select is correct as it returns a value in SQL worksheet for
> instance.
>
I don't have fruity tables, but here is your example, modified to use scott/tiger:
#!/usr/local/bin/php
<?php
$con=oci_connect("scott","tiger","LOCAL");
$sql="select ename from emp";
$stmt=oci_parse($con,$sql);
oci_execute($stmt,OCI_DEFAULT);
while( oci_fetch($stmt)) {
$val=oci_result($stmt,1); print("Value=$val\n"); }
oci_free_statement($stmt);
?>
There are two minor flaws in your program:
Have a good weekend.
-- http://www.mgogala.comReceived on Sun Apr 09 2006 - 15:37:17 CDT