i am receiving this error
"Illegal string offset 'code_room'"
when i get data code_room from api. and I realized this section of code in the file is wrong. however I'm not that great in PHP yet and I am wondering if someone can help me re-write this section to eliminate the error. Thanks!
My code
<?php
$id_class = $post['id_room_class'];
$response7 = \Unirest\Request::get($uri.'/room/'.$id_class, $headers); //API URI
$data7 = $response7->raw_body; // Unparsed body
$roomtypeclass = json_decode($data7, true);
foreach ($roomtypeclass as $get) { ?>
<button class="btn m-btn--square btn-success" data-dismiss="modal" id="btnRoom" onclick="showData2();">
<?php echo $get['code_room']; ?>
</button>
<?php } ?>