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

2018-08-13 16:40:49 +08:00
 alex321

我有一条语句,在 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;

1203 次点击
所在节点    PHP
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/479390

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX