Dear all,
I use mysql workbench and I have active field which attribute is bit type,when I display view, it just display the idnews,the active is null,hope you check my code to display active value, here is my code.
Model attributes:
$criteria->compare(‘idnews’,$this->idnews);
$criteria->compare(‘title’,$this->title,true);
$criteria->compare(‘active’,$this->active);
Controller:
public function actionIndex(){
$model = News::model()->findAll();
$this->render('index',array(
'models'=>$model,
));
}
View:
<?php if($models != null): ?>
<?php foreach($models as $model): ?>
<?php echo($model->idnews);echo($model->active);die;?>
<?php endforeach; ?>
<?php endif; ?>
the value in datbase.
idnews title active
26 test 1
thankyou very much