beforesave doesnt work in yii … here i go before i create a record in tbl1 i need to assign the expiry date in tbl1 ie., done by adding tbl2 duration following is the code
$end_date = date("Y-m-d H:i:s", strtotime($today . " + $duration days ")); (this line gives the error)
if ($this->isNewRecord){
$this->createdate = new CDbExpression('NOW()');
$this->updatedate = new CDbExpression('NOW()');
$today=$this->createdate;
var_dump($today);
$sid=$this->sid;
var_dump($sid);
$sql2="select duration
from tbl2
where ( pid=". $_GET['pid'] ." and sid=". $sid.")";
$duration=Yii::app()->db->createCommand($sql2)->queryScalar();
var_dump($duration);
$end_date = date("Y-m-d H:i:s", strtotime($today . " + $duration days ")); (this line gives the error)
$this->expirydate=$end_date;
the thing is my expirydate is being stored in db i got to know the days left i.e.,expirydate - current date .i din’t get you can you please explain what exactly you wanna say