Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.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
Postgresql 查询substr Codeigniter的位置_Postgresql_Codeigniter_Where - Fatal编程技术网

Postgresql 查询substr Codeigniter的位置

Postgresql 查询substr Codeigniter的位置,postgresql,codeigniter,where,Postgresql,Codeigniter,Where,我必须检查数据库中字符串的两个字符。 这是我的代码,但它不起作用 function getby_substr() { $query = $this->db ->where('substr(ipv6, 4,2 )', 'c1') ->get('computer_information'); if ($query->num_rows() > 0) { r

我必须检查数据库中字符串的两个字符。 这是我的代码,但它不起作用

    function getby_substr() {
    $query =  $this->db
                   ->where('substr(ipv6, 4,2 )', 'c1')
                   ->get('computer_information');
    if ($query->num_rows() > 0) {
        return $query->result();
    }
    return array();
}
谢谢,

希望这对您有所帮助:

带where子句

带like子句


更多信息:

使用如下常规查询尝试where条件:$this->db->whereSUBSTRipv6,4,2='c1';关于列和值匹配的更多详细信息谢谢你,布拉格!
      /*replace column_name with your table field name*/
      $query =  $this->db
               ->where('column_name', SUBSTRING(ipv6, 2, 5))
               ->get('computer_information');
     $query =  $this->db
               ->like('column_name', SUBSTRING(ipv6, 2, 5))
               ->get('computer_information');