|
查看: 827|回复: 5
|
sql database 问题
[复制链接]
|
|
|
假设,我有一个table (mapinfo), 内有column ( maplocation, city, state, poscode, areacovered)
我要search by keyword, 假如我打bangsar, 那么column里的资料如果有bangsar这个字的话result就会display出来。
那么
$query = "select maplocation from mapinfo where maplocation or city or poscode or state or areacovered like \"%$trimmed%\"
order by city"
对吗?
还有更好的方法吗? |
|
|
|
|
|
|
|
|
|
|
发表于 31-3-2008 11:55 AM
|
显示全部楼层
Query有问题。必须:
..WHERE maplocation like \"%$trimmed%\" or
city like \"%$trimmed%\" or
poscode like \"%$trimmed%\"or
state like \"%$trimmed%\" or
areacovered like \"%$trimmed%\"
这样才能search全部有$trimmed string的record。 |
|
|
|
|
|
|
|
|
|
|
发表于 31-3-2008 12:09 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 31-3-2008 04:19 PM
|
显示全部楼层
|
我不大记得了,但印象中, mysql 好像有个东西叫 full text search 的。。。 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 31-3-2008 04:51 PM
|
显示全部楼层
|
噢噢,full text search,有看过,好的,我再去学学看,谢谢哦!!!!谢谢~~ |
|
|
|
|
|
|
|
|
|
|
发表于 31-3-2008 05:35 PM
|
显示全部楼层
小弟孤陋寡闻了,竟然不懂有这样一个东西。
刚刚上网找了一下,竟然得到:
“Imagine having a database that contained 10,000 tables. In each of these tables there are 1,000 rows with 100 fields. How would you effectively search this sort of information structure without killing your web server? The answer is MySQL's full-text search capabilities. ”
果然是好东西,小弟也要学!谢谢楼主开帖& tensaix兄的指点!
creme兄,有什么发现,单声来分享下 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|