PHP and OCI8 queries return no results
797618Sep 14 2010 — edited Sep 22 2010I am developing a web application using PHP and an oracle database, with the OCI8 interface for PHP. The database has a DATE column, and when I try a statement like select date_column from table where date_column between '22-DEC-44' and '22-DEC-92' using SQL developer, it returns various results, but when I do the exact same query from php through OCI8, it returns nothing. And yes, I connected successfully to the DB, since I can lookup other columns well. Just the dates give me trouble.
Here is the php code that returns nothing:
//$start = "22-DEC-44" $end = "22-DEC-92"
$s = oci_parse($c, "SELECT DATE_COL FROM DATA WHERE (DATE_COL between '$start' and $end)");
oci_execute($s);
This is the SQL developer statement that works perfectly:
SELECT DATE_COL FROM DATA WHERE (DATE_COL between '$start' and '$end')
A query like the one below, works on both php and sql developer:
SELECT DATE_COL FROM DATA WHERE (DATE_COL = '$start')
only the statements with the boundaries (X between 'Y' and 'Z') and (X >= 'Y' and X <= 'Z') don't work.
please help,
Thank you