2013-01-08 265 views
-1

请访问以下链接:在那六个降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(主键)的外键在医生_detail表

例如,如果我选择

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

如果我从下拉列表中选择以上所有东西....并点击开始按钮...

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

+0

那么,什么是你的问题? – wakooka

+0

你可以使用JOINS。然后在where子句中放入所有的条件,它会输出你的结果。 –

+0

如何从数据库中获得可能的o/p ... –

回答

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