Forgive me if it is asked before, but i couldn't find the relevant keyword to search. I will try to explain my problem.
I have DB tables named "ilan" and "places". In "ilan" table, there are 3 columns which holds IDs of places - city, district, street.
And I want to learn what to do to print ilan.name and related places.name in the view.
I have a controller like:
class Estate_control extends CI_Controller{
public function _construct(){
parent::_construct();
}
function index(){
$this->load->helper('url');
$this->load->model("estate_model");
$data['tum_bayiler'] = $this->estate_model->tum_bayileri_listele();
$data['sonEmlaklar'] = $this->estate_model->sonEmlaklar();
$this->load->view("index",$data);
}
}
I have model like:
class Estate_model extends CI_Model{
function __construct(){
parent::__construct();
}
function sonEmlaklar(){
$query = $this->db
->select()
->from("ilan")
->order_by("gunceltarih DESC")
->limit(36)
->get();
return $query->result();
}
}
My DB tables:
ilan:
ilan_id, gunceltarih, ... , ilan_city(an ID in places table), ilan_district(an ID in places table), ilan_street(an ID in places table), ...
places:
places_id, places_name, ...
Any ideas on what to do to print ilan.name and related places.name in the view.
Thanks everyone.
$this->db->join()