Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to enable CakePHP's SQL dump in the controller

    • 0
    • 2
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4.99k
    Comment on it

    Hello All,


    In this blog we will discuss about how to enable the SQL dump in your CakePhp's controller.


    For this you have to write in below code in your controller function-


    $db=ConnectionManager::getDataSource('default');
    $db->showLog();
    

    The above code will show a log of all queries that is requested in from your controller function.


    Example-

    public function abc(){
    $this->layout="default";
    $userData=$this->User-find('all');
    //Below code to run SQL dump on your controller
    $db=ConnectionManager::getDataSource('default');
    $db->showLog();
    $this->set('userData',$userData);
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: