开发者

I want to select a particular list of words containing certain characters using php

I want to select a particular list of words in a paragraph containing certain characters

$query_search_text= "SELECT * FROM para where para_main='%text_words'";

I tried using the % sign, but it does not work.开发者_JS百科 It works if I give in the full text.

Thanks Jean


Try the following:

$query_search_text= "SELECT * FROM para where para_main LIKE '%text_words%'";


The % is just a wildcard, and is valid only for a LIKE comparison. The query you've written will select all rows where para_main begins with the string "text_words".

If you want to allow other characters both before and after, you'll have to use:

$query_search_text= "SELECT * FROM para where para_main LIKE '%text_words%'";


Its actually!

$query_search_text = "SELECT * FROM para where para_main LIKE '%text_words%'";

I also would advise you is too look at FullText searching. http://devzone.zend.com/article/1304


SELECT * FROM para WHERE para_main LIKE '%text_words%'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜