I have 3 tables 1>disease_table [columns=] (disease_id,disease_name)2>symptom_table [columns=] (symptom_id,symptom_name)3>disease_symptom [columns=] (disease_id,symptom_id)

I want it to display disease name based on symptoms entered by user through checkboxes which can be any number of symptoms. So I know that disease_id will be primary key in disease_table, but I don't understand how to relate disease_id,symptom_id in disease_symptom table.Also I have something like this in mind

select disease_name,disease_id 
from disease_symptom ds
InnerJoin symptom_table s on ds.symptom_id=s.symptom_id
InnerJoin disease_table d on d.disease_id=s.disease_id
where s.symptom_name in('checkbox1.text','checkbox2.text',.... and so on)

So basically what I want to know is how to relate disease_id,symptom_id in disease_symptom table and how to pass dynamically adjusted number of parameter (user could select 3 checkboxes , sometimes 4 ,5 etc)...Thanks

Related posts

Recent Viewed