$this->db->select('*');
$this->db->from('draw');
$this->db->where('Bond#' >= $data['from']);
$this->db->where('Bond#' <= $data['to']);
return $this->db->get();
这是我的查询,但它显示了此输出:
数组([list] =&gt; CI_DB_mysqli_result对象([conn_id] =&gt; mysqli对象([affected_rows] =&gt; 0 [client_info] =&gt; mysqlnd 5.0.11-dev - 20120503 - $ Id:76b08b24596e12d4553bd41fc93cccd5bac2fe7a $ [client_version] =&gt; 50011 [connect_errno] =&gt; 0 [connect_error] =&gt; [errno] =&gt; 0 [错误] =&gt; [error_list] =&gt;数组()[field_count] =&gt; 8 [ host_info] =&gt; localhost通过TCP / IP [info] =&gt; [insert_id] =&gt; 0 [server_info] =&gt; 5.7.17 [server_version] =&gt; 50717 [stat] =&gt;正常运行时间:1930线程: 1个问题:1153慢查询:0打开:135刷新表:1打开表:122每秒查询平均值:0.597 [sqlstate] =&gt; 00000 [protocol_version] =&gt; 10 [thread_id] =&gt; 101 [warning_count] = &gt; 0)[result_id] =&gt; mysqli_result对象([current_field] =&gt; 0 [field_count] =&gt; 8 [length] =&gt; [num_rows] =&gt; 0 [type] =&gt; 0)[result_array ] =&gt; Array()[result_object] =&gt; Array()[custom_result_object] =&gt; Array()[current_row] =&gt; 0 [n um_rows] =&gt; [row_data] =&gt; ))
答案 0 :(得分:0)
您应该使用where子句中的逗号(,)来分隔列名和数据。
像这样更改查询。
$this->db->select('*');
$this->db->from('draw');
$this->db->where('Yourfieldname >=', $data['from']);
$this->db->where('Yourfieldname <=', $data['to']);
return $this->db->get();
答案 1 :(得分:0)
根据文档,您必须使用列名替换Bond#并更改您的查询:https://www.codeigniter.com/user_guide/database/query_builder.html#looking-for-specific-data
$this->db->select('*');
$this->db->from('draw');
$this->db->where('Bond# >=', $data['from']);
$this->db->where('Bond#', $data['to']);
return $this->db->get();
Bond#必须是查询中列的名称。