Home > PHP Framework > YII > body text

How to print sql in yii

Release: 2019-12-17 13:48:37
Original
3045 people have browsed it

How to print sql in yii

If you want to print Sql, you can replace the commands you want to execute such as queryAll(), queryOne(), execute() with getRawSql();

For example :

If you want to see

$result = Yii::$app->db->createCommand()->update('table', ['name' => $name], "id = {$id}")->execute();
Copy after login

, you can use

echo $sql = Yii::$app->db->createCommand()->update('table', ['name' => $name], "id = {$id}")->getRawSql();
Copy after login

to print it

PHP Chinese website, there are a lot of free Yii introductory tutorials, everyone is welcome to learn!

The above is the detailed content of How to print sql in yii. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template