ainoy31 Posted August 3, 2007 Share Posted August 3, 2007 I have two tables: Table 1: (carrier) carrier_ID int(16) NOT NULL auto_increment, carrier_name varchar(64) NOT NULL, carrier_phone varchar(12) NOT NULL, carrier_email varchar(32) NOT NULL, PRIMARY KEY (carrier_ID) Table 2: (flight_schedule) fs_ID int(16) NOT NULL auto_increment, carrier_ID int(16) NOT NULL, fs_date varchar(32) NOT NULL, fs_deptport varchar(32) NOT NULL, fs_destport varchar(32) NOT NULL, PRIMARY KEY (fs_ID), FOREIGN KEY (carrier_ID) REFERENCES carrier (carrier_ID) I am having an issue with this query working: $sql = "SELECT * FROM carrier c, flight_schedule fs WHERE c.carrier_ID = fs.carrier_ID AND fs.fs_date = '$reqDate' AND fs.fs_deptport = '$reqDeptAirport' AND fs.fs_destport = '$reqDestAirport'"; Any suggestions would be appreciated. ty. Ainoy Quote Link to comment https://forums.phpfreaks.com/topic/63191-solved-query-a-db/ Share on other sites More sharing options...
akitchin Posted August 3, 2007 Share Posted August 3, 2007 i'm going to guess that it's because you're not specifying the table in the field list (even though it's just a *), despite having multiple tables in your FROM section: $sql = "SELECT c.*, fs.* FROM carrier c, flight_schedule fs WHERE c.carrier_ID = fs.carrier_ID AND fs.fs_date = '$reqDate' AND fs.fs_deptport = '$reqDeptAirport' AND fs.fs_destport = '$reqDestAirport'"; Quote Link to comment https://forums.phpfreaks.com/topic/63191-solved-query-a-db/#findComment-314940 Share on other sites More sharing options...
ainoy31 Posted August 3, 2007 Author Share Posted August 3, 2007 u know what the problem was. nothing to do with the query statement. the date field was not in the same format. the DB had a date type and the date entered was not in the date type format. i found out by comapring one thing at a time and there u go. much appreciation man. Quote Link to comment https://forums.phpfreaks.com/topic/63191-solved-query-a-db/#findComment-315011 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.