Skip to content
Advertisement

How to search for for strings/keywords in Access database using PHP?

I’m working on a school assignment and I’ve an Access database which has a memo field that stores lots of text. I wanna know how I can search for specific keywords in that memo field. For instance, from my search box I want to search for following keywords in the memo field whether they are stored in upper or lower case. PHP, Java, SQL, Python, MySQL

If any one of the keywords are present in the text field, then results will show up.

Advertisement

Answer

Assuming MS Access is the database and the keywords of interest are (PHP, Java, SQL, Python, MySQL) you could use the following:

select *
from   name_of_your_table
where  lcase(memo_field_name) like '*php*'
    or lcase(memo_field_name) like '*java*'
    or lcase(memo_field_name) like '*sql*'
    or lcase(memo_field_name) like '*python*'
    or lcase(memo_field_name) like '*mysql*'

The lcase function changes all characters in the memo field to lower case. That way, when compared with your keywords in lower case, it is essentially performing a case insensitive search.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement