将会话设置为db值的双维数组

I have a dynamic menu and I want to send the user to a new page on click with some db values. I want to use a session here without forms or via $_GET.

Presently, using the code below, only the last value of the loop is appearing in the $_SESSION. Perhaps I need to use a 2D array here, but I am not sure what to do:

<?php
$i =  $cit['city_id'];
$selectCity = $dbh->prepare("SELECT * FROM `table` where city_id=$i");
$selectCity->execute();
$cityNum = $selectCity->fetchAll();

foreach($cityNum as $cities)
{
    $_SESSION['$centreNum'] = $cities['centre_id'];
    ?>

    <li class="first"><a href="page2.php"><?php echo ucwords($cities['centre_location']); echo $_SESSION['$centerNum']; ?></a></li>
    <?php
}

$centre_num = $cities['centre_id'];
?>

You have a couple problems (the one I think you mean to do...) in your example:

...
$cityNum = $selectCity->fetchAll();

foreach($cityNum as $cities)
{
    # Not sure if you are trying keep this a variable key or not.
    #                |      Make this session an array, you keep overwriting variable
    #                |      |
    #                |      |
    #         v------+---v  v
    $_SESSION['$centreNum'][] = $cities['centre_id'];
    ?>
...continue