简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM