How To Access A Table Values Using Foreign Key Value

hello everyone . i will make it simple i have two tables patient and doctor . doctor id (d_Id) is primary key in doctor and foreign key in patient . i have created a CRUD application on patient on creating a patient record i want to select doctor names using foreign key and display in dropdownlist box please help me with code and where to edit thanks in advance

Here’s where I learned to do it.




echo CHtml::activeDropDownList('Patient', 'd_Id', CHtml::listData(Doctor::model()->findAll(), 'd_Id', 'd_Name'));



Or something similar.

[size=2]

thanks guys you made my day . i have been searching it for a day

thanks guys you made my day . i have been searching it for a day