Jump to content

[SOLVED] SQL Pattern Matching


ainoy31

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/66359-solved-sql-pattern-matching/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.