Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need SLQ reg exp keyword search for MS ACCESS using PHP

Status
Not open for further replies.

bnownlater

Programmer
Jan 16, 2002
8
US
I am using an php to access a MS Access db. I want to use a regular expression to find the keywords in a phrase, but only if they are the start of any word in that phrase. For

example: $keyword="eat"
Matched: eat the cat, he is eating, the man eater,..
No Match: beat the time, trun up the heat,...

Using LIKE '%&quot;.$keyword.&quot;%' brings up too much junk.I was prevoiusly give REGEXP '[[:<:]]&quot;.$keyword.&quot;'&quot;, but this will only work for a mySql db. Please help. Thanks.
 
use LEFT(&quot;Eating&quot;,3)

____________________________________________________
Invest your time in learning, Not in practicing.

DEK
 
That is not going to work. i really not sure if you can even use regular expressions in a query to an MS Access db.

This is the current sql query:
$Sql=&quot;Select * FROM MYTABLE WHERE TITLE LIKE '%eat%' AND TITLE LIKE '%fish%'&quot;;

I want to be able to search the TITLE phrase for each keyword that a user enters. So if the user entered &quot;eat fish&quot;, I would bring up all TITLEs that contain the words eat and fish at the begging of the word.

So my results would be:
The Eating Fish, Fishing and Eating for Dummies, Eat More Fish

These would not be in the results:

The Beating Fish, Bullfish Meat,...

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top