Home  >  Article  >  Backend Development  >  php mysql like method to implement multi-keyword search

php mysql like method to implement multi-keyword search

墨辰丷
墨辰丷Original
2018-05-31 09:51:192092browse

This article mainly introduces the method of implementing multi-keyword search in php mysql like. Interested friends can refer to it. I hope it will be helpful to everyone.

Or called, word segmentation search database

$res = mysql_query("select * from peter where id like '%Chinese herbal medicine%' and '%6%'") ; //Writing like this is an error;

$res = mysql_query("select * from peter where id like '%中文字幕%' or '%6%'"); //Writing like this is correct ; Strange~

$res = mysql_query("select * from peter where id like '%中文字幕%' and id like '%6%'"); //This is correct to write ;

$res = mysql_query("select * from peter where id like '%中文字幕%' or id like '%6%'"); //Writing this way is correct;

The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

How to read large CSV files with PHP and import them into the database

phpMethod to implement DES encryption and decryption consistent with c

#PHP practical tutorial methods of filtering, verification, escaping and password

The above is the detailed content of php mysql like method to implement multi-keyword search. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn