Yii Framework Forum: How to display the rendered query before it's executed. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to display the rendered query before it's executed. How to display the rendered query before it's executed. Rate Topic: -----

#1 User is offline   yii new expert 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 30-May 12
  • Location:pune, india

Posted 29 June 2012 - 07:09 AM

How to display the rendered query before it's executed.
        $sql="SELECT * from users WHERE user_id = :user_id";
        $command=Yii::app()->db->createCommand($sql);
        // replace the placeholder ":user_id" with the actual username value
        $command->bindParam(":user_id",$user_id,PDO::PARAM_INT);
        echo "<br/>".$command->getText();

I would like to print query included with bind param
e.g user_id = 1 then
SELECT * from users WHERE user_id = 1

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users