Tag: yii
CDbCommand Yii 1
A good practice of programming is to use “statement”, to do CRUD actions in a safe and scalable way. The Yii framework has by default its library for ease of development. SELECT Queryng with the template referencing the primary key: INSERT DELETE
Yii Error: include(Controller.php): failed to open stream: No such file or directory
This error occurred because the references to the classes were not equal to the file name, but the application was always installed on Windows Server, which is not “case sensitive “, so it worked. The error appeared from the moment we put it on AWS with a Linux server, which is case sensitive. But to […]
Yii Error: CDbConnection failed to open the DB connection: could not find driver
Error: CDbConnection failed to open the DB connection: could not find driver C:\xampp72\htdocs\DEV\project\protected\models\SystemConfiguration.php(50) Solution: In php.ini, enable the configurations according to the base used: extension=mbstringextension=exif ; Must be after mbstring as it depends on itextension=mysqli;extension=oci8_12c ; Use with Oracle Database 12c Instant Client;extension=odbc;extension=openssl;extension=pdo_firebirdextension=pdo_mysql;extension=pdo_oci;extension=pdo_odbcextension=pdo_pgsqlextension=pdo_sqliteextension=pgsql;extension=shmop
Yii Error: permission denied for relation my_table
ERROR: permission denied for relation site_adzone This error occurs because you need to give the database user permission. Solution, execute the query: GRANT ALL PRIVILEGES ON TABLE userdb.table_xpto TO userdb;
Yii Error: short tag
Error: user->isGuest) { $this->redirect(array(‘login’)); } else { $sqlUser = “SELECT CASE WHEN us.data_senha_date <= now() THEN 1 ELSE 0 END AS ativo FROM database.tb_users as us WHERE us.usuario_id =” . Yii::app()->user->id; $uer = Yii::app()->db->createCommand($sqlUser)->queryRow(); Yii::app()->session[‘webUserExpirado’] = $usuario; if ($usuario[‘ativo’] == 1) { $this->redirect(array(‘usuario/changePassword’, ‘ns’ => 1)); } else { //$array = Yii::app()->session[‘webUserClientesList’]; //print_r(Yii::app()->session[‘webUserPerfil’]); //$array = (Yii::app()->session[‘webUserUFTest’]); //print_r($array[“0”][“uf_sigla”]); //print(Yii::app()->session[‘webUserExpirado’]); //print_r(Yii::app()->session[‘webUserTest’]); […]
Moeda | Tipo | Valor |
Dollar | Compra | R$ 5,97 |
Dollar | Venda | R$ 5,97 |
Data | 22/01/2025 |
Yii Model
27 de August de 2019
Yii
No Comments
adrianoApi
Yii Model Delete <?php $model=User::model()->findByPk($id); if($model){ $model->delete(); } # OR $model=User::model()->deleteAll(); # OR $model=User::model()->deleteAll(array(“condition”=>”userid=’$id'”)); # OR $mode=User::model()->deleteAll(“status=’A'”); ?> Yii Model Update <?php $model=User::model()->updateByPk( $ID, array(“status”=>’DECLINED’) ); # OR $model=User::model()->updateAll(array( ‘first_name’=>”$firstname”, ’email’=>”$email” ), “UserID=$id and status IS NULL ” ); # OR $model=User::model()->updateAll( array(‘status’ => 1), ‘UserID =’.$userid ); ?>
yii