hi guys I need your help once again, I’m trying to get some data from my db, lets say… there is two tables
tbl_unit and tbl_device, tbl_unit has a field called DeviceId, and those tables are related by that field, and then in tbl_device there is a field wich is called odometer… here is the deal I need to get the data from odometer fiel by searching the unit with the unit id … and show it into a form… as far as I read, its made via ajax…
any contributtion will be pretty much aprecciated
you can try use sql command
I’m not sure I interpreted your question correctly, but if you get the unit in the controller action and pass it to the unit view for rendering, you should be able to get the value by:
You have to load the model and then, as samsonyv said, you can go throught relations like this $model->relationName->odometer.
But it also depends on the type of relation. If there are more than 2 “odometer” results, it won’t show anything unless you do a loop with a foreach.