rwhn.net
当前位置:首页 >> yii2 ExECutECommAnD >>

yii2 ExECutECommAnD

$connection = Yii::app()->db; //连接 //查找 $sql = “SELECT * FROM `tbl_user` ORDER BY id DESC”; $command = $connection->createCommand($sql); $result = $command->queryAll(); print_r($result); //添加 $sql = ” INSERT INTO `tbl_use...

$connection = Yii::app()->db; //连接 //查找 $sql = “SELECT * FROM `tbl_user` ORDER BY id DESC”; $command = $connection->createCommand($sql); $result = $command->queryAll(); print_r($result); //添加 $sql = ” INSERT INTO `tbl_use...

执行: Yii::$app->getDb()->createCommand("Your SQL")->execute(); 查询: Yii::$app->getDb()->createCommand("Your SQL")->queryAll(); 其他: Yii::$app->getDb()->createCommand("Your SQL")->xxx!

执行: Yii::$app->getDb()->createCommand("Your SQL")->execute(); 查询: Yii::$app->getDb()->createCommand("Your SQL")->queryAll(); 其他: Yii::$app->getDb()->createCommand("Your SQL")->xxx

执行: Yii::$app->getDb()->createCommand("Your SQL")->execute(); 查询: Yii::$app->getDb()->createCommand("Your SQL")->queryAll(); 其他: Yii::$app->getDb()->createCommand("Your SQL")->xxx

Yii::app()->db->getLastInsertID()

28行下,find里面 ad_name 和 adminpwd的变量都没有带引号; 改成这样 "ad_name =". $adminname." and adminpwd = ".$adminpwd;

执行: Yii::$app->getDb()->createCommand("Your SQL")->execute(); 查询: Yii::$app->getDb()->createCommand("Your SQL")->queryAll(); 其他: Yii::$app->getDb()->createCommand("Your SQL")->xxx

$connection = Yii::app()->db; //连接 //查找 $sql = “SELECT * FROM `tbl_user` ORDER BY id DESC”; $command = $connection->createCommand($sql); $result = $command->queryAll(); print_r($result); //添加 $sql = ” INSERT INTO `tbl_use...

先创建连接对象 $connection = new \yii\db\Connection([ 'dsn' => $dsn, 'username' => $username, 'password' => $password, ]); $connection->open(); 查询返回多行: $command = $connection->createCommand('SELECT * FROM post'); $posts ...

网站首页 | 网站地图
All rights reserved Powered by www.rwhn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com