Here, I like to explain my problem clearly,
I have table called claims
in that there is field called TRT
(turn around time).
In this field user set a date(example: 2015-07-09),
Every time admin used to check a pendings availble or not, example: if today's date and TRT date is same then the Pending data automatically moves to another table.
so what i did is ,
$today = date('Y-m-d');
$dt1 = ArrayHelper::map(Importclaims::find()->all(),'id','turn_around_time_set');
foreach ($dt1 as $key => $value)
{
$trt = print_r($value, true);
if($today == $trt)
{
$sql = "INSERT INTO importpending (claimer_name, status, template, last_trt, email)
SELECT employee_name, status_new, template, turn_around_time_set, tpa
FROM importclaims WHERE id = $name1 ";
$query = Yii::$app->db->createCommand($sql)->execute();
echo '<div class="alert alert-success"> Pendings Availble </div>';
}
else
{
echo '<div class="alert alert-success"> No Pendings Availble </div>';
}
// return $this->redirect(['index']);
}
but this executing only those TRT equal to today's date, but i need to check every TRT date which is lesser than equal todays date.
simply, Insert data those TRT date less and equal to today's date