通过php中的动态多下拉列表搜索结果

时间:2013-01-08 13:10:31

标签: php jquery mysql ajax

请访问此链接:http://tndoctors.in/doctors.php

在那六个下拉框中有na .... (国家,地区,地点,医学,专业,等级)

我将所有数据从SQL DB中获取到所有DROPDOWN BOXES。

我创建了像

这样的表格

STATE (state id & state name) [st.id as primary key]

DISTRICT(district id , district name and used state id as foreign key here)

location (location id , location name and used district id as foreign key here)

如上所述,医药,专业和等级..............

最后我创建了一个表

DOCTOR_DETAIL ( name , address , reg.no , contact details , age , and specialty , grade , medicine , district and state)

对于专业,年级,医学,地区和州我使用上表id(主键)作为医生_detail表中的外键

例如,如果我选择

 STATE: TAMILNADU
 DISTRICT: COIMBATORE
 LOCATION : some data
 medicine : allopathy
 speciality : cardiac surgeon
 grade    : some data....

如果我从下拉列表中选择以上所有内容....并单击转到按钮...

我必须得到可能的搜索结果

1 个答案:

答案 0 :(得分:0)

尝试像这样的查询,仅限样本

select  location , district , state from state as st left join district as dt on(dt.fkstate_id = st.id) left join location as lt on(lt.fkdistrictId = dt.id) where // Where condition