PHP + MySQL - search script (full text)?

I would like to ask for help in solving this problem: I have a MySQL table with a structure like this:

author                name        year       description
Bernard Cornwell      Azincourt   2009       Publisher XY, good condition

Now I would like to have MySQL Query, which returns the result (looking for a book) on different inputs (for example, these):

  • Cornwell
  • Agincourt
  • Cornwell Asinkour
  • Azincourt cornwell
  • Cornwell Azincourt 2009
  • Bernard Cornwell Asinkour
  • Agincourt

Do I need to add a Fulltext index for each column, and then on the author, name, year, description?

+4
source share
1 answer

Are you looking for something like this?

Select * From TableName WHERE description LIKE "%searchvalue%";

, , . wild card, , , . , , .

Select * From TableName WHERE description = "searchvalue";

PHP script, .

0

Source: https://habr.com/ru/post/1617897/


All Articles