Guest User

Untitled

a guest
Sep 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. Yii How to display the rendered query before it's executed
  2. $sql="SELECT * from users WHERE user_id = :user_id";
  3. $command=Yii::app()->db->createCommand($sql);
  4. // replace the placeholder ":user_id" with the actual username value
  5. $command->bindParam(":user_id",$user_id,PDO::PARAM_INT);
  6. echo "<br/>".$command->getText();
  7.  
  8. SELECT * from users WHERE user_id = 1
  9.  
  10. SET GLOBAL general_log = 'ON';
  11.  
  12. SELECT * FROM mysql.general_log;
  13.  
  14. SET GLOBAL general_log = 'OFF';
Add Comment
Please, Sign In to add comment