Using Yii, I want to delete all the rows that are not from today.
Is my solution ok ?
$query = "delete from `user_login_hash` where `day`!='".(date('Y-m-d',time()))."'";
Yii::app()->db->createCommand($query);
Using Yii, I want to delete all the rows that are not from today.
Is my solution ok ?
$query = "delete from `user_login_hash` where `day`!='".(date('Y-m-d',time()))."'";
Yii::app()->db->createCommand($query);
A prettier solution is
Better user PDO parameters and on command you also have to call
execute
or
Try this...
You may use query builder
http://www.yiiframework.com/doc/guide/1.1/en/database.query-builder#sec-15