Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.


This is my code: $data = Users::find(array( 'username = :username: and password = :password:', 'bind' => $post ));

I want just after the SQL;

I know print_r ($data) can see SQL but that is not resolved, could you tell me is there a better way?

edited Sep '14
$di->set('profiler', function() {
    return new \Phalcon\Db\Profiler();
    }, true);

    $di->set('db', function() use ($config,$di) {

    $eventsManager = new \Phalcon\Events\Manager();

    $profiler = $di->getProfiler();

    $eventsManager->attach('db', function($event, $connection) use($profiler) {
        if ($event->getType() == 'beforQuery') {

        if ($event->getType() == 'afterQuery') {

    $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array(
        "host" => $config->database->host,
        "username" => $config->database->username,
        "password" => $config->database->password,
        "dbname" => $config->database->name,
        'charset' => 'utf8'


    return $connection;

CGI/FastCGI stop working

This is what problem, my environment is nginx phpstudy use


What do you mean by "CGI/FastCGI stop working"?


Yes, after I modify about database configuration there, as long as there is a database access operation method is the pop-up CGI stop working, and do not have a database query access method, there is no proble


What do you mean by "CGI/FastCGI stop working"? SELECT, users.nickname, users.username, users.password, users.regional_id, users.community_id, users.created_at FROM users WHERE users.username = :username AND users.password = :password LIMIT 1

Thanks, got it, but it is not what I want, because I can't see the value of the username and password, in some cases, I think it is necessary according to the correct value to judge whether the SQL execution