Sql 我需要修复代码点火器查询

Sql 我需要修复代码点火器查询,sql,codeigniter,codeigniter-2,code-injection,Sql,Codeigniter,Codeigniter 2,Code Injection,我试图在table3 id数组的基础上从table1和table2获得详细信息。 表2提供了表3 id和表1 id //$ids是一个ID数组,如:array([ids]=>10,11) 当您有多个值时,应在 替换 $this->db->where(); 与 两者都需要(col,value) 注://$ids=数组(10,11) 您好,您可以这样使用where_in function get_detail($ids) { $this->db->select(

我试图在table3 id数组的基础上从table1和table2获得详细信息。 表2提供了表3 id和表1 id

//$ids是一个ID数组,如:array([ids]=>10,11)


当您有多个值时,应在

替换

$this->db->where();

两者都需要(col,value)


注://$ids=数组(10,11)

您好,您可以这样使用where_in

function get_detail($ids) { 

    $this->db->select('*');
    $this->db->from('table1');
    $this->db->join('table2', 'table1.aID = table2.aID');
    $this->db->join('table3', 'table2.bID = table3.bID','left');
    $this->db->where_in('table3.bID', $ids); 
    $query = $this->db->get();      

}
注意:以数组格式传递$id

$ids=数组(10,11)

您可以使用数组

$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);

$this->db->where($array);
$array=array('name!='=>$name,'id'=>$date);
$this->db->where($array);
如何将foreach()用于类数组([sectionIDs]=>1,2,3,4)或如何将数组([sectionIDs]=>1,2,3,4)拆分为
数组([0]=>1[1]=>2[2]=>3[3]=>4)
如何将foreach()用于类数组([sectionIDs]=>1,2,3,4)或如何拆分数组([sectionIDs]=>1,2,3,4)进入
数组([0]=>1,[1]=>2,[2]=>3,[3]=>4)
function get_detail($ids) { 

    $this->db->select('*');
    $this->db->from('table1');
    $this->db->join('table2', 'table1.aID = table2.aID');
    $this->db->join('table3', 'table2.bID = table3.bID','left');
    $this->db->where_in('table3.bID', $ids); 
    $query = $this->db->get();      

}
$array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);

$this->db->where($array);