在我从Excell导入到数据库后,我尝试从数据库中选择我的数据,如下代码
问题如果我复制 In_no 值 (isp14065556) 并传递到文本编辑器,然后传递回表中的 in_no,我的 select by where 也将起作用。为什么?
我的In_no类型表是varchar(30),我使用In_no作为Where子句。
问题 我可以通过键入来选择 by where if I insert in_no 字符串值,但无法选择 by where if In_no 字符串值从 Excel 导入( in_no 内容存储在 Excel 中并导入到 Db 中)。
我不明白为什么,因为 in_no 类型是 varchar(30) 并且我在使用 Where 子句选择数据方面有更多经验来自DB很多次。但是这个我真的不明白为什么从excel导入数据时我无法选择数据。
public function printds(){
$segment = $this->uri->segment(3);
$this->db->select('*');
$this->db->from('dbfinan_dupl_invoice');
$this->db->where('in_no',$segment);//tested arary('in_no'=>$segment)
$query = $this->db->get();
return $query->result();
}
在 Controller 中
public function printd(){
$segment = $this->uri->segment(3);
$this->data['invoice_val'] = $this->invoice_m->select_ad_val($segment);
$this->data['print_item'] = $this->invoice_m->printds($segment);
$this->load->view('frontend/print/print_dup',$this->data);
}
非常感谢 friend 的热情
最佳答案
请使用此代码
$segment = $this->uri->segment(3);
$data['invoice_val'] = $this->invoice_m->select_ad_val($segment);
$data['print_item'] = $this->invoice_m->printds($segment);
$this->load->view('frontend/print/print_dup',$this->data);
关于php - 在 Codeigniter 中从 Excel 导入时,无法使用 where 子句选择数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31019634/