Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/409.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
Javascript 如果值不为NULL,则Codeigniter联接_Javascript_Php_Codeigniter_Join - Fatal编程技术网

Javascript 如果值不为NULL,则Codeigniter联接

Javascript 如果值不为NULL,则Codeigniter联接,javascript,php,codeigniter,join,Javascript,Php,Codeigniter,Join,我想要的代码是,如果我找到了字段数据,那么我想将该特定数据连接到另一个表 $this->db->select('*'); $this->db->from('userprofile'); $this->db->where('userId', $userId); $this->db->where('status', 1); $this->db->join('bodytype', 'bodytype.b

我想要的代码是,如果我找到了字段数据,那么我想将该特定数据连接到另一个表

    $this->db->select('*');
    $this->db->from('userprofile');
    $this->db->where('userId', $userId);
    $this->db->where('status', 1);
    $this->db->join('bodytype', 'bodytype.bodyTypeId = userprofile.bodyType');
    $this->db->join('children', 'children.childrenId = userprofile.children');
    $this->db->join('ethnticity', 'ethnticity.ethnticityId = userprofile.ethnicity');
    $this->db->join('smoke', 'smoke.smokeId = userprofile.smoke');
    $this->db->join('drink', 'drink.drinkId = userprofile.drink');
    $query = $this->db->get();
    return $query->result();
如果我得到userprofile.bodyType,然后运行bodyType joinquery。有什么方法可以处理它吗?

从这个堆栈:

将此where子句添加到查询中

$this->db->where('bodyType is NOT NULL', NULL, FALSE);
尝试内部联接:

$this->db->join('bodytype', 'bodytype.bodyTypeId = userprofile.bodyType','inner');