ainoy31 Posted August 23, 2007 Share Posted August 23, 2007 Hi. I have a scenario where I am trying to find a match in my query. $query = "SELECT requestID FROM requests WHERE deptAirport = '$reqDeptAirport' AND destAirport = '$reqDestAirport' AND date = '$reqDate'"; My problem is that the info in the DB for the deptAiport and destAirport is a four letter code such as PADK. However, on the website when the user makes a selection it could be a 4 to 10 letter code such as AMES MUN - KAMW. I just need to match the last four letter code from the DB and the selection from the website. I saw there is an operator REGEXP or '^.....$' that I can use. I tried using the REGEXP like this: ...WHERE deptAirport REGEXP = '$reqDeptAirport' AND destAirport REGEXP = '$reqDestAirport'... Much appreciation. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 23, 2007 Share Posted August 23, 2007 Well, you can use RIGHT(yourField, 4).... Quote Link to comment Share on other sites More sharing options...
ainoy31 Posted August 23, 2007 Author Share Posted August 23, 2007 thanks man Quote Link to comment 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.