简体   繁体   English

mysql搜索字符串的一部分

[英]mysql search part of string

I've got the a field in a table in my database which contains the following HTML code: 我在数据库的表中有一个字段,其中包含以下HTML代码:

<table class="table_productinfo" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr><td class="attribute_head"><strong>Ausführung:</strong></td><td><strong>500mm</strong></td></tr>
<tr><td class="attribute_head">Farbe:</td><td>weiß glänzend</td></tr><tr><td class="attribute_head">Material:</td><td>Keramik</td></tr>
<tr><td class="attribute_head">Hersteller:</td><td>antoniolupi</td></tr>
<tr><td class="attribute_head">Serie:</td><td>ALBUM</td></tr>
<tr><td class="attribute_head">Design:</td><td>Prospero Rasulo</td></tr>
<tr><td class="attribute_head">Bemerkung:</td><td>Auch zur Wandmontage geeignet</td></tr>
<tr><td class="attribute_head">Höhe in mm:</td><td>150</td></tr>
<tr><td class="attribute_head">Tiefe in mm:</td><td>500</td></tr><tr><td class="attribute_head">Breite in mm:</td><td>500</td></tr>
<tr><td class="attribute_head">Artikelnummer:</td><td>NLALB</td></tr>
</tbody>
</table>

Now I'd like to submit a search string via php: 现在,我想通过php提交搜索字符串:

antoniolupi album prospero

What do I have to do to find this specific row with this content? 我要怎么做才能找到包含此内容的特定行?

I tried stuff like splitting the keyword explode(' ',$keyword) and to find partial occurances, but I can't get the sql query I need to get. 我尝试过诸如拆分关键字explode(' ',$keyword)类的事情explode(' ',$keyword)并查找部分出现的事件,但是我无法获取需要获取的sql查询。

In there where clause use the like search term on the column you are searching. 在where子句中,在要搜索的列上使用类似的搜索词。 Where column_name like '%search_term" after that you can just join all the search terms depending if you just need one to match or all of them to match. 之后,column_name就像“%search_term”一样,您可以将所有搜索词加入进来,这取决于您只需要一个匹配项还是全部匹配项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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