PHP warning

count(): Parameter must be an array or an object that implements Countable

/home/ivanwilmington/public_html/protected/views/air/list.php(53)

41             <div class="u12" style="width: 100%;">
42 
43                 <table id="my-table"class="table">
44                     <thead>
45                       <tr>
46                         <th>City/Area</th>
47                         <th>Location</th>
48                         <th class="text-center" style="width: 332px;">Community Air-Quality Level (CAL)</th>
49                       </tr>
50                     </thead>
51                     <tbody>
52                         <?php 
53                             for($i=0; $i<count($model); $i++){
54                                 //var_dump($model[$i]->active);
55                                 //echo '<br><br>';
56                             ?>
57                             <tr style="border-bottom: 1px; border-bottom-color: #3e3e3e;">
58                                 <td><a href="<?php echo Yii::app()->request->baseUrl; ?>/air/<?php echo $model[$i]->dylos; ?>" class="linkList" style="color: #6a6d6f;"><?php echo $model[$i]->city; ?></a></td>
59                                 <td><a href="<?php echo Yii::app()->request->baseUrl; ?>/air/<?php echo $model[$i]->dylos; ?>" class="linkList" style="color: #6a6d6f;"><?php echo $model[$i]->address; ?></a></td>
60                                 <td>
61                                 <?php if($model[$i]->active == 1){ ?>
62                                     <p style="width: 100%; height: 100%; color: #000; text-align: center; background: <?php echo Monitor::getColor($model[$i]->cal);  ?>;"><?php echo Monitor::getMsg($model[$i]->cal);?></p>
63                                     <?php }else{ ?>
64                                     <p style="width: 100%; height: 100%; color: #000; text-align: center; background: <?php echo Monitor::getColor(-1);  ?>;"><?php echo Monitor::getMsg(-1);?></p>
65                                     <?php } ?>

Stack Trace

#4
+
 /home/ivanwilmington/public_html/protected/controllers/AirController.php(87): CController->render("list", array("model" => null))
82         public function actionList(){
83             $url = 'https://ivan-imperial.org/air/datajson';
84             $model = json_decode(file_get_contents($url));
85             
86             $this->render('list',array(
87                 'model'=>$model,
88             ));
89             
90         }
91 }
#17
+
 /home/ivanwilmington/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-18 19:59:05 Apache Yii Framework/1.1.20