CodeIgniter 是否支持PDO 查询?还是本来就不支持? 本帖最后由 default7 于 2014-11-15 19:34:55 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 查看php.ini是否有开启pdo扩展。 已经开启了PDO,否则 $result_id->fetchAll() 是得不到数据的。 if (is_object($result_id) && $result_id->execute()) { if (is_numeric(stripos($sql, 'SELECT'))) { $this->affect_rows = count($result_id->fetchAll()); $result_id->execute(); //再执行一次 } else { $this->affect_rows = $result_id->rowCount(); } }虽然 rowCount 方法可能对某些数据库的 select 指令无效,但对于 mysql 的 select 指令还是有效的所以把 $this->affect_rows = count($result_id->fetchAll());改为 $this->affect_rows = $result_id->rowCount();也是可以的何况他对常见数据库都单独提供了操作类 linux 服务器 php 5.3.3 不支持 mhash吗? js 访问禁止403 php笔试题 windows 2003 php 500错误 php读ntext 的问题,急 今天遭遇soso蜘蛛洗劫 下载的php程序在英文版的xp窗口下显示乱码 权限问题 急求一段验证用户登录验证的代码 怎么根据微信id代码自动生成生成关注微信公众号二维码图片 thinkphp过滤表单表达式的函数
已经开启了PDO,否则 $result_id->fetchAll() 是得不到数据的。
{
if (is_numeric(stripos($sql, 'SELECT')))
{
$this->affect_rows = count($result_id->fetchAll());
$result_id->execute(); //再执行一次
}
else
{
$this->affect_rows = $result_id->rowCount();
}
}虽然 rowCount 方法可能对某些数据库的 select 指令无效,但对于 mysql 的 select 指令还是有效的
所以把
$this->affect_rows = count($result_id->fetchAll());
改为
$this->affect_rows = $result_id->rowCount();
也是可以的
何况他对常见数据库都单独提供了操作类