PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, December 30, 2021

[FIXED] How show all queries to database in yii framework

 December 30, 2021     yii     No comments   

Issue

In CodeIgniter I would do:

print_r ($this->db->queries);

In Yii I tried:

 print_r (Yii::app()->db)

But this doesn't show any queries.

UPDATE: I understand my problem: when I want to show db queries on a POST action, I don't show it. When using GET, it's ok.


Solution

As @bool.dev said, you can use CWebLogRoute or in my case i use CFileLogRoute to store these queries in file.

array (
    'class'      => 'CFileLogRoute',
    'categories' => 'system.db.*',
    'logFile'    => 'sql.log',
),


Answered By - briiC
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing