Multiple Column search of mysql database using PHP
For multiple column search in mysql. you first need to index the table using the query
ALTER TABLE list ADD FULLTEXT (column1,column2,...and so on)
then just use the MATCH in either PHPMYADMIN or directly through PHP, I am writing the below code for PHPMYADMIN
SELECT column1, column2,
MATCH (
MATCH (
column1, column2
)
AGAINST (
AGAINST (
'Search Term1 OR Search Term1'
)
FROM table_name
WHERE MATCH (
FROM table_name
WHERE MATCH (
column1, column2
)
AGAINST (
AGAINST (
'Search Term1 OR Search Term1'
)LIMIT 0 , 30
Comments
Post a Comment