php - 在 Codeigniter 中从 Excel 导入时,无法使用 where 子句选择数据

标签 php mysql sql-server excel codeigniter

在我从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);
    }

enter image description here

非常感谢 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/

相关文章:

php - 如何将行值分隔到 PHP 和 MySQL 中的不同列中

php - mysql 查询帮助插入到多行,其中几个字段相同

mysql - 内部 JOIN 只是最后的结果

mysql - XML 数据插入 MySql DB

c# - Entity Framework 通用存储库与上下文直接查询

php - PS-4 PHP 包 - 主文件夹类无法访问子文件夹类 - 命名空间

php - fatal error : Cannot pass parameter 2 by reference in %$name%

mysql - 将字典键映射到 Mysql 数据库表列

mysql - 数据库 Upserts - 好的还是坏的做法?

sql-server - vb6 - 用于 sql server 的 NUMERIC 和 microsoft ole db 提供程序