PHP warning

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

/home/ivanwilmington/public_html/protected/views/air/map_1.php(19)

07     var myLatlng = {lat: 33.9459957, lng: -117.4695685};
08 //    var myLatlng = {lat: 32.979953, lng: -115.530992};
09     //[i][0]= location name
10     //[i][1]= lat
11     //[i][2]= lng
12     //[i][3]= id
13     //[i][4][]= PM25
14     //[i][5][]= PM10 
15     var monitors = [
16         
17         <?php 
18             //foreach ($model as $row){ 
19             for($i=0; $i<count($row); $i++){
20                 if($row[$i]->active == 1){
21         ?>    
22                 [
23                     '<?php echo $row[$i]->address; ?>', 
24                     <?php echo $row[$i]->lat; ?>,
25                     <?php echo $row[$i]->lng; ?>, 
26                     <?php  echo $row[$i]->dylos; ?>, 
27                     [
28                         <?php echo $row[$i]->cal; ?>, 
29                     ],
30                 ], 
31         <?php

Stack Trace

#3
+
 /home/ivanwilmington/public_html/protected/views/air/map.php(20): CController->renderPartial("map_1", array("row" => null))
15             <div class="u12" style="width: 100%;">
16 
17                 <div id="map"></div>
18                 <?php 
19                     $this->renderPartial('map_1', array(
20                         'row'=>$model,
21                     ));
22                 ?>
23             </div>
24         </div>
25     </div>
#8
+
 /home/ivanwilmington/public_html/protected/controllers/AirController.php(77): CController->render("map", array("model" => null))
72         public function actionMap(){
73             $url = 'https://ivan-imperial.org/air/datajson';
74             $model = json_decode(file_get_contents($url));
75             
76             $this->render('map',array(
77                'model'=>$model,
78             ));
79         }
80         
81         
82         public function actionList(){
#21
+
 /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 22:57:45 Apache Yii Framework/1.1.20