When connecting to a database with PHP I have been using an ODBC connection with the following query:
"SELECT * FROM TAB.LE WHERE TAB.LE.Id = 1";
Where the tablename is TAB.LE
.
The code used to make the query isn't required here - but it works fine returning the correct result(s). When I use an OCI connection the same query fails:
$conn = oci_connect("username", "password", "database");
if($conn){
$query = "SELECT * FROM TAB.LE WHERE TAB.LE.Id = 1";
$stid = oci_parse($conn, $query);
$res = oci_execute($query);
if($res){
echo "success";
}
else{
echo "failed";
}
}
I constantly see failed
on the screen. I am stumped as to why. The odd thing is: the tablename TAB.LE
works for the ODBC connection; however, when viewed in MS Access it shows as TAB_LE
. I have attempted to use this different notation in the OCI connection but to no avail.
oci_execute() Executes a statement previously returned from oci_parse().
$stid = oci_parse($conn, $query);
So change
$res = oci_execute($query);
To
$res = oci_execute($stid);