-4

Half of my code are working fine. Then Throwing error. Please help to fix this error.

for ($i = 0; $i <= 61; $i++) {
if(isset($arr[$racknos[$i]])){
        $var9[] = $arr[$racknos[$i]]['mat_code'];
        $var10[] = $arr[$racknos[$i]]['m_lon'];
        $var11[] = $arr[$racknos[$i]]['m_lar'];
        $var12[] = $arr[$racknos[$i]]['c_lign']." - ".$arr[$racknos[$i]]['cdc_p'];
}
}
foreach($var9 as $product){
                    echo $product."<br>";
                }

Fatal error: Uncaught Error: [] operator not supported for strings in C:\xampp\htdocs\IDB\IMS\bay_left.php:25 Stack trace: #0 C:\xampp\htdocs\IDB\IMS\a2l.php(68): include() #1 C:\xampp\htdocs\IDB\IMS\ims.php(29): include('C:\xampp\htdocs...') #2 C:\xampp\htdocs\IDB\index.php(94): include('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\IDB\IMS\bay_left.php on line 25

0

1 Answer 1

0

Try this?

$var9 = $arr[$racknos[$i]]['mat_code'];
$var10 = $arr[$racknos[$i]]['m_lon'];
$var11 = $arr[$racknos[$i]]['m_lar'];
$var12 = $arr[$racknos[$i]]['c_lign']." - ".$arr[$racknos[$i]]['cdc_p'];
Sign up to request clarification or add additional context in comments.

1 Comment

Tried this. It gives only one value from the array. But I am getting results without fatel error

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.