Monday, April 3, 2017

Assigning variable to an array (error)

I'm assigning a variable to an array that i declared in blade file. It returns an error of

ErrorException in 4c73f52d03e3e1331e7b4c0289cafb82dfc22253.php line 127:
Undefined offset: 0 (View:
/var/www/myteam/resources/views/servicedetails.blade.php)

Below is my code:

<?php $i = 0 ?>
@foreach($var as $v)
<?php $ary = array(); ?>
    <tr>
        <td name="attrname"><b></b><br><br></td>
        <td>: <a><input contenteditable="true" name="attrvalue" value=""></a> <br></td>
        <?php $v->service_attribute_value = $ary[$i] ?>
        <?php $i++ ?>
    </tr>
@endforeach

I couldnt understand the error. Thank you!



via Fadhil Adzfar

Advertisement