iPixel Posted December 3, 2009 Share Posted December 3, 2009 So basically i'm pulling data from two tables where both tables have a commong field. filenumber in employee_directory is equal to dognet_user_id in mvx.phone_history_io. I ran a small simple query to test the php, and it worked fine, so there's something wrong with this query and i cant seem to understand what. I dont get any errors, i simply dont get a result. And i dont know if it's the mysql part or the php part of it that im having issues with. Here's the query i run. <?php $sql_1 = "SELECT employee_directory.filenumber, employee_directory.phone, employee_directory.firstname, employee_directory.lastname, employee_directory.managerid, employee_directory.departmentid, employee_directory.branchid, pcsmgr.mvx_phone_history_io.extension, pcsmgr.mvx_phone_history_io.calldate, pcsmgr.mvx_phone_history_io.calltype, pcsmgr.mvx_phone_history_io.dur_seconds, pcsmgr.mvx_phone_history_io.dur_minutes, pcsmgr.mvx_phone_history_io.dist_pnums, pcsmgr.mvx_phone_history_io.count_pnums, pcsmgr.mvx_phone_history_io.dognet_user_id, pcsmgr.mvx_phone_history_io.callcat FROM employee_directory, pcsmgr.mvx_phone_history_io WHERE employee_directory.managerid = '$DT_filenumber' AND employee_directory.branchid = '$branchid_SQL' AND pcsmgr.mvx_phone_history_io.calldate BETWEEN '$sDate' AND '$eDate' AND employee_directory.filenumber = pcsmgr.mvx_phone_history_io.dognet_user_id ORDER BY employee_directory.firstname ASC"; $go_1 = oci_parse($conn, $sql_1); oci_execute($go_1); if($result_1 = oci_fetch_assoc($go_1)) { echo "GOOD"; } else { echo "BAD"; } // THIS KEEPS SHOWING UP ?> Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/ Share on other sites More sharing options...
iPixel Posted December 3, 2009 Author Share Posted December 3, 2009 Ok i've figured out what causes the issue. It's this line.... AND employee_directory.filenumber = pcsmgr.mvx_phone_history_io.dognet_user_id My guess is that it's beacuse of the pcsmgr. i guess two dots is too many LOL. But i have to use this because that table is in a different schema on the database. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970519 Share on other sites More sharing options...
iPixel Posted December 3, 2009 Author Share Posted December 3, 2009 I also tried using an alias for the table, but still i get "BAD" as result. <?php $sql_1 = "SELECT EmpDir.filenumber, EmpDir.firstname, EmpDir.lastname, EmpDir.managerid, EmpDir.departmentid, EmpDir.branchid, MVX.extension, MVX.calldate, MVX.calltype, MVX.callcat, MVX.dur_seconds, MVX.dur_minutes, MVX.dist_pnums, MVX.count_pnums, MVX.dognet_user_id FROM employee_directory EmpDir, pcsmgr.mvx_phone_history_io MVX WHERE EmpDir.managerid = '$DT_filenumber' AND EmpDir.branchid = '$branchid_SQL' AND MVX.calldate BETWEEN '$sDate' AND '$eDate' AND EmpDir.filenumber = MVX.dognet_user_id ORDER BY EmpDir.firstname ASC"; $go_1 = oci_parse($conn, $sql_1); oci_execute($go_1); if($result_1 = oci_fetch_assoc($go_1)) { echo "GOOD"; } else { echo "BAD"; } // STILL GET THIS ?> Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970553 Share on other sites More sharing options...
rajivgonsalves Posted December 3, 2009 Share Posted December 3, 2009 why don't you check http://php.net/manual/en/function.oci-error.php it may help you to pinpoint your problem Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970562 Share on other sites More sharing options...
iPixel Posted December 3, 2009 Author Share Posted December 3, 2009 LOL i know what happened, i was using yesterdays dates and the database ppl did not update these tables with yesterdays data and neglected to tell me.... this is what happens when you assume ! Thanks Though! Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970567 Share on other sites More sharing options...
Kryptix Posted December 3, 2009 Share Posted December 3, 2009 Click 'Solved' Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970611 Share on other sites More sharing options...
Kryptix Posted December 3, 2009 Share Posted December 3, 2009 Typical, eh? Quote Link to comment https://forums.phpfreaks.com/topic/183855-whats-wrong-with-my-query/#findComment-970614 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.