I have 1st PHP page named session1.php with code below:
<?php
session_start();
.....mysql connection...
$sql = "SELECT name1, brand, price FROM products WHERE name1='cuvette' ORDER BY 'name1' ASC,'desc1' ASC";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
$_SESSION['tag'] = $row;
print_r($_SESSION['tag']);
}
It outputs:
Array ( [0] => Cuvette [name1] => Cuvette [1] => HmbG [brand] => HmbG [2] => 9.00 [price] => 9.00 )
Array ( [0] => Cuvette [name1] => Cuvette [1] => HmbG [brand] => HmbG [2] => 8.00 [price] => 8.00 )
Then I setup 2nd PHP page named session2.php with code below:
<?php
session_start();
print_r($_SESSION['tag']);
?>
But session2.php only ouputts:
Array ( [0] => Cuvette [name1] => Cuvette [1] => HmbG [brand] => HmbG [2] => 8.00 [price] => 8.00 )
I am expecting the results should be same with session1.php(2 arrays). Anyone has the explanation for this??