我必须category name,description,id
从tbl_ticket_categories
所选中选择id
我必须user_id
从中找到tbl_ticket_repliers
并且我必须从user_id
中找到。username
tbl_users
最后选择的属性应该是category_name, description and username
. 我在做什么我的观点是:-
function editCategory($site_referers_id) {
$this->db->select('tbl_ticket_categories.category_name,tbl_ticket_categories.description,tbl_users.username,tbl_ticket_repliers.user_id');
$this->db->where('site_referers_id',$site_referers_id);
$this->db->join('tbl_ticket_repliers','tbl_ticket_repliers.category_id = tbl_ticket_categories.id');
$this->db->join('tbl_users','tbl_users.id = tbl_ticket_repliers.user_id');
return $this->db->get('tbl_ticket_categories');
}
在我看来,当我这样做<?php var_dump($categories); ?>
时显示:-
object(CI_DB_mysql_result)[32]
public 'conn_id' => resource(43, mysql link persistent)
public 'result_id' => resource(81, mysql result)
public 'result_array' =>
array
empty
public 'result_object' =>
array
empty
public 'custom_result_object' =>
array
empty
public 'current_row' => int 0
public 'num_rows' => int 1
public 'row_data' => null
如何进行此查询:(
我的桌子是:-
tbl_ticket_categories(id , category_name , description , site_referers_id)
tbl_ticket_repliers(id , user_id , category_id , site_referer_id)
tbl_users(id , role_id , username , password )
解决了