douchunsui2395
douchunsui2395
2014-07-09 14:32

致命错误:在第42行的system \ database \ drivers \ pdo \ pdo_result.php中的非对象上调用成员函数rowCount()

  • pdo
  • codeigniter
  • php
已采纳

I'm trying to use the PDO MySQL driver in my CodeIgniter (2.2.0) application but i don't know why i have this error. This is my database config:

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'mysql:host=localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'mydbname';
$db['default']['dbdriver'] = 'pdo';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Call Stack

#   Time    Memory  Function    Location
{main}( )   ..\index.php:0
require_once( 'D:\wamp\www\CodeIgniter_2.2.0\system\core\CodeIgniter.php' ) ..\index.php:202
3   0.0279  1142584 Login->__construct( )   ..\CodeIgniter.php:308
4   0.0279  1142584 CI_Controller->__construct( )   ..\Login.php:15
5   0.0308  1338688 CI_Loader->initialize( )    ..\Controller.php:51
6   0.0308  1338664 CI_Loader->_ci_autoloader( )    ..\Loader.php:152
7   0.0467  2338736 CI_Loader->library( )   ..\Loader.php:1178
8   0.0467  2338920 CI_Loader->_ci_load_class( )    ..\Loader.php:216
9   0.0487  2471440 CI_Loader->_ci_init_class( )    ..\Loader.php:975
10  0.0492  2473816 CI_Session->__construct( )  ..\Loader.php:1099
11  0.0521  2574776 CI_Session->sess_read( )    ..\Session.php:106
12  0.0541  2580216 CI_DB_active_record->get( ) ..\Session.php:229
13  0.0542  2582224 CI_DB_driver->query( )  ..\DB_active_rec.php:963
14  0.0566  2670472 CI_DB_pdo_result->num_rows( )   ..\DB_driver.php:386

My default controller is Login.php:

class Login extends CI_Controller{

    function __construct()
    {
        parent::__construct();

    }

    function index(){
        echo 'hello';

    }
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dsk710351 dsk710351 7年前

    I found this bug reported against CodeIgniter 2.2.0.

    The recommended fix is either to avoid the PDO driver in CodeIgniter, or to upgrade to CodeIgniter 3.0.

    点赞 评论 复制链接分享