开发者

I can't connect to database

开发者 https://www.devze.com 2023-03-31 07:30 出处:网络
I use Kohana 3.2, and when I insert in the index.php controller $query = DB::query(Database::SELECT, \'SELECT * FROM posts ORDER By id DESC\');, I see the error ErrorException [ Fat开发者_高级运维al E

I use Kohana 3.2, and when I insert in the index.php controller $query = DB::query(Database::SELECT, 'SELECT * FROM posts ORDER By id DESC');, I see the error ErrorException [ Fat开发者_高级运维al Error ]: Class 'Database' not found. What do I do?


This isn't a database error. The database class cannot be found and I'm almost sure it's because of following reasons:

You probably haven't installed and configured the database module properly. Make sure that the database module is in the module path you specified in the index file:

$modules = '../your/path/to/modules';

Furthermore, enable the module in your bootstrap (application/bootstrap.php):

Kohana::modules(array(
  // Rest of modules
  'database' => MODPATH.'database',
));

More info about modules can be found here: http://kohanaframework.org/3.2/guide/kohana/modules

0

精彩评论

暂无评论...
验证码 换一张
取 消