Besides the extremely correct fabrik answer, there are just a few lines in your code:
foreach($_SESSION as $sir){ }
this cycle obviously does nothing. you cannot get any output from code that doesn't output anything :)
In addition, if you want to save multiple values ββin a session, for example, in a shopping cart, you must save in the array, not a long, concatenated string:
$_SESSION['cart'][] =$result;
will create an array named $ _SESSION ['cart'], which can be repeated as desired:
foreach ($_SESSION['cart'] as $result){ echo "Item id: ".$result['id'].", name: ".$result['name']."<br>\n"; }
source share