0

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

在那六个下拉框中没有....(州,地区,位置,医学,专业,等级)

我将所有数据从 SQL DB 提取到所有下拉框。

我创建了像

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作为表(primary key)中的外键doctor _detail

例如,如果我选择

州:TAMILNADU 区:COIMBATORE 位置:一些数据医学:同种疗法专业:心脏外科医生等级:一些数据....

如果我从下拉列表中选择以上所有内容...并单击“开始”按钮...

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

4

1 回答 1

0

加入表是最好的选择

SELECT * FROM DOCTOR_DETAIL
LEFT JOIN DISTRICT ON  DISTRICT.district id = DOCTOR_DETAIL.district id
LEFT JOIN STATE ON STATE.state_id = DOCTOR_DETAIL.state_id
..for all tables required
WHERE DISTRICT.name = '".$district_name."' AND SATET.name = '".$state_name."'
...For all filters that you reqiored

希望这可以帮助 :)

于 2013-01-16T05:07:49.300 回答