V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
alex321
V2EX  ›  PHP

CI 怎么才能正常从 Access 中读取数据出来?

  •  
  •   alex321 · 2018-08-13 16:40:49 +08:00 · 1213 次点击
    这是一个创建于 2321 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我有一条语句,在 MDBPlus 小工具中是正常执行出来结果的,但是在 CI 中怎么查询都是空。求大神搭救。

    环境

    CI 3.1.9,PHP 5.6.37 ,IIS7.5。

    CI 配置

    	'dsn'	=> '',
    	'hostname' => 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=access.mdb',
    	'username' => '',
    	'password' => '',
    	'database' => 'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=access.mdb',
    	'dbdriver' => 'odbc',
    	'dbprefix' => '',
    	'pconnect' => FALSE,
    	'db_debug' => (ENVIRONMENT !== 'production'),
    	'cache_on' => FALSE,
    	'cachedir' => '',
    	'char_set' => 'gb2312', // 更换过 utf8
    	'dbcollat' => 'gbk', // 更换过 utf8_general_ci
    	'swap_pre' => '',
    	'encrypt' => FALSE,
    	'compress' => FALSE,
    	'stricton' => FALSE,
    	'failover' => array(),
    	'save_queries' => TRUE
    );
    

    CI 查询结果

    (
        [conn_id] => Resource id #6
        [result_id] => Resource id #7
        [result_array] => Array
            (
            )
    
        [result_object] => Array
            (
            )
    
        [custom_result_object] => Array
            (
            )
    
        [current_row] => 0
        [num_rows] => 
        [row_data] => 
    )
    

    查询语句

    SELECT * FROM (SELECT CHECKTIME FROM CHECKINOUT WHERE USERID = 5 AND CHECKTIME LIKE '2018-3%' UNION SELECT CHECKTIME FROM CHECKINOUT WHERE USERID = 5 AND CHECKTIME LIKE '2018-4%' UNION SELECT CHECKTIME FROM CHECKINOUT WHERE USERID = 5 AND CHECKTIME LIKE '2018-5%' UNION SELECT CHECKTIME FROM CHECKINOUT WHERE USERID = 5 AND CHECKTIME LIKE '2018-6%' UNION SELECT CHECKTIME FROM CHECKINOUT WHERE USERID = 5 AND CHECKTIME LIKE '2018-7%') AS i ORDER BY CHECKTIME ASC;

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1096 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:48 · PVG 02:48 · LAX 10:48 · JFK 13:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.