Php/ MySql 'Advanced Search' Page

后端 未结 5 2041

I\'m working on an \'advanced search\' page on a site where you would enter a keyword such as \'I like apples\' and it can search the database using the following options:

5条回答
  •  长发绾君心
    2021-02-04 16:00

    Giraffe and Re0sless pooseted 2 good answers.

    notes: "SELECT * " sucks... only select the columns that you need. Re0sless puts a "OR" between keywords. - you should eliminate common words (" ","i","am","and"..etc) - mysql has a 8kb i belive limit on the size of the query, so for really long SELECTS you should slipt it into separate queries. - try to eliminate duplicate keywords (if i search for "you know you like it" the SELECT should basically only search for "you" once and elimnate common words as "it")

    Also try to use "LIKE" and "MATCH LIKE" (see mysql man page) it could do wonders for "fuzzy" searches

提交回复
热议问题