我有这个查询:
select name, body
from news
where body like %MyWord%;
我使用MySQL数据库引擎。当在正文中发现MyWord时,此查询将返回名称和正文。
我在这里的问题是,当我在正文中搜索两个单词时,比如MyWord1,MyWord2或更多!
如果你知道该查询是由函数调用的(我无法每次修改该查询),那么我该怎么做?
我有这个查询:
select name, body
from news
where body like %MyWord%;
我使用MySQL数据库引擎。当在正文中发现MyWord时,此查询将返回名称和正文。
我在这里的问题是,当我在正文中搜索两个单词时,比如MyWord1,MyWord2或更多!
如果你知道该查询是由函数调用的(我无法每次修改该查询),那么我该怎么做?
如果您在文字搜索模式上需要更大的功能,请在MySQL中以适当的指数使用
如果能满足你们的需要,你将能够一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一一二一字。
您可以使用一些邪恶的SQL注入(类似的):)
我假设你将“我的词语”传递给包含查询的函数,你不能改变它。如果“我的词语”看起来像这样会发生什么:
MyWord1% 或者 body 包含 %MyWord2
恶劣,我知道,你已经被警告了 ;)
如果你想找到两个不同的词,你可以这样做:
select name, body
from news
where body like %MyWord1% and body like %MyWord2%;
然而,这很快就会变得非常不好,你可以研究其他一些选择:
I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...
Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...
What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...