I want to search a combination of values from any given field that has a list of items.
Example:
id | nume | denumiri_job
1 | my_list | chair,apple,snake,can
How can I search for 2 or more elements from the field list? For example if I input in my search bar the values 'chair snake' I want to get all the rows that contain these 2 items in the denumiri_job column. Right now I can only get the results if I use one search key at a time.
So far this is how I managed my code:
$query = "SELECT id, data, nume, prenume, email, telefon, limbi_straine, denumiri_job, cv, observatii, interview, acceptat, plecat, stare FROM candidati WHERE (data LIKE '%$val%'
OR nume LIKE '%$val%'
OR prenume LIKE '%$val%'
OR email LIKE '%$val%'
OR telefon LIKE '%$val%'
OR limbi_straine LIKE '%$val%'
OR denumiri_job LIKE '%$val%'
OR observatii LIKE '%$val%'
OR interview LIKE '%$val%'
OR acceptat LIKE '%$val%'
OR plecat LIKE '%$val%'
OR stare LIKE '%$val%')";