本帖最后由 default7 于 2014-11-15 19:34:55 编辑

解决方案 »

  1.   

    查看php.ini是否有开启pdo扩展。
      

  2.   


    已经开启了PDO,否则  $result_id->fetchAll() 是得不到数据的。
      

  3.   

            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();
    也是可以的
    何况他对常见数据库都单独提供了操作类