Im trying to connect the db in yii connection how can i do that ?
In below screen shot there is an cron.php i have trying to connect the database from root folder how to d that ?
Cron.php
require('framework/db/CDbConnection.php');
$connection=new CDbConnection($dsn,'root','');
$connection->active=true;
I need to use Yii connection instead of mysql
$mysql_con = mysql_connect('localhost','root','');
mysql_select_db('som',$mysql_con); //local DB
If you want to use cron
for some tasks, consider creating yii console application commands. Configure it to use your db settings and call tasks that you need like that yiic <command-name> <action-name>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.