我从Excell 导入 DB后尝试从DB中选择我的数据,如下面的代码所示
问题如果我复制In_no值(isp14065556)并传入文本编辑器并传回表中的in_no,我的选择也将起作用。 为什么?
我的In_no类型表是varchar(30) ,我使用In_no作为Where子句 。
如果我通过键入插入in_no字符串值,我可以选择问题我无法选择从Excel导入的In_no字符串值的位置( 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(); }在控制器中
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); }非常感谢你的朋友
I have try to select my data from DB after I imported from Excell into DB as below code
Problem If I copy In_no value (isp14065556) and pass into text editor and pass back into in_no in the table my select by where will work as well. Why?
My table of In_no type is varchar(30) and I used In_no for Where clause.
Issue I can selected by where if I insert in_no string values by typing and I can't select by where if In_no string value which imported from Excel ( in_no content which store in Excel and was imported into Db).
I don't understand why because in_no type is varchar(30) and I have more experience with using Where clause to select data from DB a lot of times. But this one I'm really don't understand why I can't select data when its was imported from 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(); }And in 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); }Thanks too much friend for your kind
最满意答案
请使用此代码
$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);@Uchiha @Abdulla Now I found the solution Feeling happy to much
'in_no' => strtolower(trim(preg_replace("/(\D+\d{4})0*([1-9]+\d*)/i", "$1$2\n", strtolower($data['IN_number'])))),I didn't clean in_no But after I used strtolower and trim it work as perfect Thanks friend for some idear
更多推荐
发布评论