data array error

How do I resolve this error

7154

data array error.PNG

Controller




    public function actionMappingadmin()

    {


        $idd =0;

        $inspectionmapping = array();

        $inspectionmapping[] = new InspectionMapping();


        $postData = Yii::$app->request->post('InspectionMapping');

        if ($postData !== null && is_array($postData)) {           //var_dump($postData);die;

            $inspectionmapping = array();

                foreach ($postData as $i => $single) {

                $inspectionmapping[$i] = new InspectionMapping();

               

            }

        }        


        if (InspectionMapping::loadMultiple($inspectionmapping, Yii::$app->request->post()) && 

        InspectionMapping::validateMultiple($inspectionmapping))

        {


            foreach ($inspectionmapping as $item) 

            {

                  //var_dump($item);die;

                $item->building_id=$row['building_id']

                $item->tariff_id=$row['tariff_id']

                $item->fee_id=$row['fee_id'];

                $item->zone_id=$row['zone_id'];

                $item->mapping_date=Date("Y/m/d");

                $item->save(false);

            }

            return $this->redirect(['index']);           


    }

            else {

        return $this->render('mappingadmin', [

        'inspectionmapping' => $inspectionmapping,

        ]);  

        }    

    }



VIEW




<?php

use yii\helpers\Html;

use yii\widgets\ActiveForm;

use yii\helpers\ArrayHelper;

use app\modules\consumers\models\Building;

use app\modules\inspection\models\InspectionBooking;

use yii\jui\DatePicker;

use kartik\widgets\Select2;

use kartik\typehead\TypeaheadBasic;

//use kartik\widgets\DepDrop;

use kartik\depdrop\DepDrop;

use yii\helpers\Url;

use app\modules\Billing\models\Fee;

$this->title = 'Mapping for Inspection';

$this->params['breadcrumbs'][] = $this->title;

?>


<style type="text/css">

/* tbody#special td+td+td {

  background:red; 

  */

tr.group,

tr.group:hover {

    background-color: #ddd !important;  

}

</style>


<script>

	$(document).ready(function(){




$('#check_all').change(function(e) {


    if($("#check_all").is(':checked'))

       {   

			$('.check').prop('checked', true);

       }

       else{

       			$('.check').prop('checked', false);

       }  


}); 

</script>


<div class="col-xs-12 col-lg-12">


<!--<div class="inspector-update">  -->


<!--</div>-->

<!--</div>-->

<div class="mapping-form">

  <?php $form = ActiveForm::begin(['id' => 'mapping-form']); ?>


<h1>Mapping for Inspection</h1>




<!-- Main content -->

<section class="content">

      <div class="row">

        <div class="col-xs-12">


              <table id="example1" class="table table-bordered table-striped">

                <thead>

                <tr>    

                  <th>#</th>

                  <th>Building</th>

                  <th></th>

                  <th>Tariff</th>

                  <th></th>

                  <th>Fee</th>

                  <th></th>

                </tr>

                </thead>

                <tbody>

            <?php $rows=(new \yii\db\Query())

        ->select(['b.building_id, b.building_name, t.tariff_id, f.fee_id']) 

        ->from('building b')

        ->join('JOIN', 'building_tariff t', 't.tariff_id = b.tariff_id')

        ->join('JOIN', 'fee f', 't.tariff_id = f.tariff_id')

        ->where([RAND > 0.667])


        ->orderBy('building_name')

        ->all();

            ?>


         <?php foreach ($inspectionmapping as $value) {  ?>  

        <?php foreach ($rows as $key => $row) {  ?> 


<?php $i = 1;

 ?>

        <tr>

        <td><?php echo $i++;?></td>

        <td class="tbl_column_name"><?php echo $row["building_id"]; ?></td>

        <td class="tbl_column_name"><?php echo $row["building_name"]; ?></td>

        <td class="tbl_column_name"><?php echo $row["tariff_id"]; ?></td>

        <td class="tbl_column_name"><?php echo $row["tariff_code"]; ?></td>

        <td class="tbl_column_name"><?php echo $row["fee_id"]; ?></td>

        <td class="tbl_column_name"><?php echo $row["value"]; ?></td>


        </tr>

    <?// endforeach; ?>


        </tbody>               

  </table>

        </div>

        <!-- /.col -->

      </div>

      <!-- /.row -->

</section>

<!-- /.content -->





<div class="form-group">

<div class="col-xs-12 col-sm-2 col-lg-2">

  <button id="but" class="btn btn-primary btn-block btn-lg" name="cancel" type="submit">Cancel</button>

</div>  

<div class="col-xs-12 col-sm-2 col-lg-2">

  <button id="but1" class="btn btn-primary btn-block btn-lg" name="continue" type="submit">Continue >></button>

</div>

</div>


<?php ActiveForm::end(); ?>

</div>  <!-- /.End of Inspection Sheet -->


</div>  <!-- /.End of col-xs-12 col-lg-12 -->





<!-- page script -->

<script>

  $(function () {


$("#example1").DataTable(

function groupTable($rows, startIndex, total){

if (total === 0){

return;

}

var i , currentIndex = startIndex, count=1, lst=[];

var tds = $rows.find('td:eq('+ currentIndex +')');

var ctrl = $(tds[0]);

lst.push($rows[0]);

for (i=1;i<=tds.length;i++){

if (ctrl.text() ==  $(tds[i]).text()){

count++;

$(tds[i]).addClass('deleted');

lst.push($rows[i]);

}

else{

if (count>1){

ctrl.attr('rowspan',count);

groupTable($(lst),startIndex+1,total-1)

}

count=1;

lst = [];

ctrl=$(tds[i]);

lst.push($rows[i]);

}

}

}

groupTable($('#example1 tr:has(td)'),0,3);

$('#example1 .deleted').remove();

  );


    $('#example2').DataTable({

      "paging": true,

      "lengthChange": false,

      "searching": true,    ///"searching": false,

      "ordering": true,

      "info": true,

      "autoWidth": false

    });

  });


</script>



You just forgot to type “;”. <_<




                $item->building_id=$row['building_id'];

                $item->tariff_id=$row['tariff_id'];



I did what you asked me to do, but this is the new error message

7155

rand errr.PNG

One step forward. :)

As for the new error (that was previously hidden), "where([RAND > 0.667])" is the cause as the error message tells.

Ive resolved that, but the issue now is that the page is blank. See screen shot below:

7156

blank.PNG