Sunday, January 2, 2022

[FIXED] how can I print my sql string in yii?

Issue

I'm using yii framework for implementing a new project. I want to see the sql string before it runs on the server. I already enabled this code in my configuration file but I still get no result

array('class'=>'CWebLogRoute',),

What should I do exactly to view the sql string when I run a webpage?


Solution

try to put this under components in main.php (config):

'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
        'weblogging'=>array(
            'class'=>'CWebLogRoute',
            'enabled'=>true,
            ),
        ),
    ),

then it will show debugging info along with all the sql ran on that page.



Answered By - Arfeen

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.