HOW TO perform query without calling of models?

Discuss everything related to ApPHP Durecty CMF. All versions. Any questions related to the Directy CMF developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

administrator
Site Admin
Site Admin
Posts: 6169
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO perform query without calling of models?

Postby administrator » Mar 18th, '15, 20:23

In some cases you may need to access database directly from controllers, models or even views. Such practise may be useful when you have no model for specific database table or you simply want to perform a separate query without using of models:

Code: Select all

// Example of direct usage of CDatabase
$result = CDatabase::init()->select('SELECT COUNT(*) as cnt FROM '.CConfig::get('db.prefix').'sessions');

Return to “ApPHP Directy CMF {developers/users}”