我使用datatables来显示旅游的重要细节,但是当我使用select查询时显示fk整数值,而我想要那里在tour_standered表中的类型名称通过codeigniter中的数据表显示fk而不是数值的名称
我的表图像如下
型号功能
public function cust_tour_primary_data(){
$this->db->select('');
$this->db->from('customized_tours');
$this->db->join('tour_standered', 'tour_standered.std_id =customized_tours.std_type','left');
$res=$this->db->get();
//return $res->result();
print_r($res->result());
echo $this->db->last_query();
}
通过以上功能,我能够得到FK的名字,但我不希望的tour_standered像创建,删除等 等领域,我想其他FK值做同样的。通过这样做,查询结果会太长,有点混乱,我也不知道如何做多重连接。
只是在选择查询中添加你需要从表中获得什么东西 –
thx它的工作原理,但在所有连接表中必须有所有唯一的名称,我得到了错误id模糊不清,所以我改变了名称现在它工作正常 –
使用别名为相同的名称列@ shivakumar –