How to print sql statement in criteria

Hi,

Can I print out the sql statement? because I wanna to test the statement in phpmyadmin

If I got following code, how can I print out the sql statement:




$criteria = new CDbCriteria();

        $criteria->addSearchCondition('ten_lc', $keyword, "OR", "LIKE");

        $criteria->addSearchCondition('bien_so', $keyword, "OR", "LIKE");


        $dataProvider = new CActiveDataProvider('LichChay', array(            

            'Criteria' => array(

                'condition' => 'ngay_kh = :ngayKH OR ma_ct = :maCT',

                'order' => 'ma_theo_doi, ngay_kh',

                'params' => array(

                    ':ngayKH' => $this->formatDbDate($keyword),

                    ':maCT'=> $congty,

                )

            ),

        ));


        $dataProvider->setCriteria($criteria);



In the end of code, I got $dataProvider variable, and how can I print out sql statement?

Any idea?

Thanks ;)

If you enable the debugging and/or tracing, the whole flow is displayed. When you scroll through this, you’ll find the query.

Hi, Random, thanks so much.

Can you describe more? I’m not really understand your way :D