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.
<?php
$val = 'test';
print "value = $val <br>";
$con=oci_connec t("dave","test" ,$bd_name);
$sql="select fruit_name from fruits where fruit_id=2";
$stmt=oci_parse ($con,$sql);
oci_execute($st mt, oci_default);
oci_fetch($stmt );
$val = oci_result($stm t,0);
oci_free_statem ent($stmt);
print "value = $val ";
?>
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.
<?php
$val = 'test';
print "value = $val <br>";
$con=oci_connec t("dave","test" ,$bd_name);
$sql="select fruit_name from fruits where fruit_id=2";
$stmt=oci_parse ($con,$sql);
oci_execute($st mt, oci_default);
oci_fetch($stmt );
$val = oci_result($stm t,0);
oci_free_statem ent($stmt);
print "value = $val ";
?>
Comment