stockton Posted August 7, 2007 Share Posted August 7, 2007 When I run the following from my php application/script I find that I get no data back but when I run just the SQL statement in Database Express' SQL Command console (Apex) I get good data back. $StartDate="2006/01/01 06:00:00"; $EndDate="2007/09/29 6:00:00"; $SQL = "SELECT TRANS_TABLE_NAME, SUM(TRANS_TURNOVER) TotalTurnover FROM TRANSACT where (TRANS_CODE = '$number' AND (TRANS_DATE BETWEEN TO_DATE('$StartDate','YYYY/MM/DD HH24:MI:SS') AND TO_DATE('$EndDate','YYYY/MM/DD HH24:MI:SS'))) GROUP BY TRANS_TABLE_NAME;"; $stmt = OCIParse($conn, $SQL ); OCIExecute($stmt); // echo $SQL; $Count = 0; while (OCIFetch($stmt)) { echo "COL1=" . ociresult($stmt, "COL1") . ", COL2=" . ociresult($stmt, "COL2") . "\n"; $Count++; } if ($Count == 0) { print "\nError code = " . ora_errorcode(); print "\nError message = " . ora_error(); $Message = sprintf("No play by [%s] found! ", $number); trigger_error($Message, E_USER_ERROR); die(); } Please tell me what I have got wrong. Link to comment https://forums.phpfreaks.com/topic/63730-solved-it-works-in-apex-but-not-in-php/ Share on other sites More sharing options...
stockton Posted August 10, 2007 Author Share Posted August 10, 2007 cj in the PHP forum on the Oracle site <http://forums.oracle.com/forums/thread.jspa?messageID=2003652�> recommended var_dump($stmt) after the parse. var_dump($stmt) returns:- resource(18) of type (oci8 statement) which, as a nooby to Oracle, I really do not understand. but his suggestion of removing the semi-colon at the end of the command line has certainly given me a different result with which I can now go forward with. Thank you cj. Link to comment https://forums.phpfreaks.com/topic/63730-solved-it-works-in-apex-but-not-in-php/#findComment-320171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.