Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 连接相同的表和列两次_Php_Mysql_Codeigniter - Fatal编程技术网

Php 连接相同的表和列两次

Php 连接相同的表和列两次,php,mysql,codeigniter,Php,Mysql,Codeigniter,我做了两张桌子。一个具有指定的工作用户(称为雇主): …第二个是用户: 我想从用户中通过在商店雇主中的se\u id列获取用户名和姓氏,并再次通过在商店雇主中的se\u so\u添加列获取用户名和姓氏。以下是我编写的代码: $this->db->from('shops_employers as se'); $this->db->where('se_s_id', $shopID); $this->db->where('se_accepted', 1); $t

我做了两张桌子。一个具有指定的工作用户(称为雇主):

…第二个是用户:

我想从用户中通过在商店雇主中的se\u id列获取用户名和姓氏,并再次通过在商店雇主中的se\u so\u添加列获取用户名和姓氏。以下是我编写的代码:

$this->db->from('shops_employers as se');
$this->db->where('se_s_id', $shopID);
$this->db->where('se_accepted', 1);
$this->db->where('se_active', 1);
$this->db->join('users as u', 'se.se_u_id = u.u_id');
return $this->db->get()->result();
但我不知道下一步该怎么办。

试试:

$this->db->from('shops_employers se');
$this->db->where('se.se_s_id', $shopID);
$this->db->where('se.se_accepted', 1);
$this->db->where('se.se_active', 1);
$this->db->join('users u', 'se.se_u_id = u.u_id', 'left');
return $this->db->get()->result();

它不起作用,它显示的是相同的名字和姓氏的Seu____\u id和Seu_so___\u add___\u id。