How to debug mysql queries in cakephp


Posted on 23 Dec 15 by Vickey

In cakephp we use find and save function for read and write data in database but we do not see the row queries behind these function.If you want to see these query you need to do some cahanges in your cakephp files

1.Open app/config/core.php file and change debug mode 0 to 2

Configure::write('debug', 0);


Configure::write('debug', 2);

2. In your layout add

echo $this->element('sql_dump');

by doing these two steps you can see and debug your cakephp queries

If this post help you reduce time to develop, you can help me to maintain this website :)