我正试图在我的网站上实现搜索功能。我有以下类型的数据。如何从MYSQL/PHP中的数据中提取匹配短语?
Title Descr
----- -----
World News World news, news from across the world, all world news events covered
World Sports World sports news, for all of sports people, sports is a famous world
现在我想,如果用户搜索“世界新闻报”,那么结果会显示类似以下,
World News (title)
... all world news events covered ... (descr)
基本上我想显示随机的基础上的一些短语。当用户搜索“世界新闻报”则有时就像他会得到导致类似上面,有时像下面,
World News (title)
World news, news from across the world, ... (descr)
请告诉我如何,我们可以使用MySQL的查询,得到这种功能,或者如果它不直接可能通过mysql查询,那么怎么可能使用PHP。
谷歌有时做同样的事情,谷歌显示短语形式中间,有时它显示的起始文本。
谢谢。
我想你没有正确地得到我的问题。我不想随机行。我想要从特定行中随机选择的短语。 – Prashant 2009-04-29 06:29:44