Hi I have some question about multiple tables handling in one time.
First this is my database structure:
[attachment=625:db1.PNG]
some example of data:
[attachment=628:00.PNG] ---------- [attachment=629:33.PNG]
and I hope I can get something like this:
[attachment=627:22.PNG]
which means I need to join the table item and item_text and show it together
I'm trying to do something like this:
$crud->set_table('items'); $crud->columns('id', 'content1', 'content2', 'content3', 'create_time'); $crud->callback_column('content1',array($this,'getContent1')); $crud->callback_column('content2',array($this,'getContent2')); $crud->callback_column('content3',array($this,'getContent3')); function getContent1($row) { $sql = "SELECT t.content FROM item_text t WHERE t.item_id = $row->id AND t.lang_type = 1"; $result = $this->db->query($sql)->row(); $title = $result->title; return $title; } function getContent2($row) { $sql = "SELECT t.content FROM item_text t WHERE t.item_id = $row->id AND t.lang_type = 2"; $result = $this->db->query($sql)->row(); $title = $result->title; return $title; } function getContent3($row) { $sql = "SELECT t.content FROM item_text t WHERE t.item_id = $row->id AND t.lang_type = 3"; $result = $this->db->query($sql)->row(); $title = $result->title; return $title; }
but it seems that the object of "$this" for the 'content1', 'content2', 'content3' will be a null object.
Any suggestion how to do this one?
Thank you very much^^