hello, i’m triyng to compare somedates in datareader foreach .
$rows = Yii::app()->db->createCommand($myproc)->query();
$precos = Yii::app()->db->createCommand($myproc)->query();
foreach ($rows as $row) {
$start = $row['inicio'];
$dtEnd = $row['fim'];
$dtLoop = date('Y-m-j', strtotime("+1 day", strtotime($start)));
$dtEnd = date('Y-m-j', strtotime("-1 day", strtotime($dtEnd)));
While ($dtLoop <= $dtEnd) {
foreach ($precos as $preco) {
$start2 = $preco['inicio'];
$dtEnd2 = $preco['fim'];
$dtLoop2 = $start2;
While ($dtLoop2 <= $dtEnd2) {
if ($start==$dtEnd2){
$js = $js . ("[" . date("m", strtotime($start)) . ", " . date("d", strtotime($start)) . ", " . date("y", strtotime($start)) . "]");
$js = $js . (",");
}
if ($start2==$dtEnd){
$js = $js . ("[" . date("m", strtotime($dtEnd)) . ", " . date("d", strtotime($dtEnd)) .
", " . date("y", strtotime($dtEnd)) . "]");
$js = $js . (",");
}
$dtLoop2 = date('Y-m-j', strtotime("+1 day", strtotime($dtLoop2)));
}
I can’t run the second foreach because error:“CDbDataReader cannot rewind. It is a forward-only reader.”
but it’s a diferent object. Do you have any ideas?