I am creating a program in PHP where users submit a file and then can search for the file based off of 6 categories that they entered when they initially created the file. The categories are stored in a table in one cell that looks like this: category_1 category_2 category_3 etc - they are not in separate columns
I need to create a page where the user can fill in the categories that they want to search by and then submit the query to the MYSQL database. I want the page to sort the rows by which files match the most categories first.
My question is how to I set up the MYSQL query to search for 6 categories and then order the results by the rows that have the most categories matched (show the one with 3 matched categories in front of the one with 2 categories matched?
I would put up code that I tried, but I don't even know where to start (do I use regular expressions?). Any help would be great. I am familiar with PHP and HTML, but MYSQL is new to me.