I m having the hardest time with a php (or mysql) search function. I d be willing to buy a script for that, but i can t find any.
I have a customer table (firstname, lastname, street, zip, city etc....) and i would like to be able to not just look for one keyword but for 2 IN 2 DIFFERENT columns.
例如:
关键词:“John Doe”
因此,我的尝试是。
SELECT ....
WHERE CONCAT(firstname,lastname) LIKE %john%
AND CONCAT(firstname,lastname LIKE %doe%
然而,这给我留下了所有的 j子,John Doe先生是名单上的某个地方,但不是站在上,尽管它本应是最重要的结果。
I also tried:
....
WHERE MATCH(firstname,lastname) AGAINST( %john doe% )
而这种结果恰恰相反。
So the result I m looking for would be:
1. John Doe (at first position!)
2. John Miller
3. John Smith
4. Harry Doe
5. Jack Doe
etc......
我looking了两小时,我拒绝相信我是最早试图这样做的人:
任何帮助都值得赞赏。
Thanks!