Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6005493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:24:18+00:00 2026-05-23T01:24:18+00:00

How can I print a list of session arrays with php? I have this

  • 0

How can I print a list of session arrays with php?

I have this php code:

foreach($wall as $v) 
    {
        $_SESSION['nickname'] = $v['user']['nickname'];
        $_SESSION['imageURL'] = $v['user']['imageURL'];
        $_SESSION['clubURL'] = $v['user']['clubURL'];
        $_SESSION['id'] = $v['id'];
        $_SESSION['date'] = $v['date'];
        $_SESSION['description'] = $v['description'];
        $_SESSION['byPhone'] = $v['byPhone'];
        $_SESSION['totalPage'] = $v['totalPage'];
        $_SESSION['userid'] = $v['user']['id'];
        $_SESSION['accountlikes'] = $v['account']['likes'] . ")";
        $_SESSION['accountdislikes'] = $v['account']['dislikes'] . ")";
        $_SESSION['accountcommentes'] = $v['account']['commentes'] . ")";
        $_SESSION['accountshares'] = $v['account']['shares'] . ")";
        $_SESSION['accountclicks'] = $v['account']['clicks'] . ")";
    }

And I want to print each value of each session variable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:24:19+00:00Added an answer on May 23, 2026 at 1:24 am

    As KingCrunch stated, you are overwriting every key of the session array with every iteration. I believe you meant for the code to look like this:

    foreach($wall as $v) 
    {
        $_SESSION['nickname'][] = $v['user']['nickname'];
        $_SESSION['imageURL'][] = $v['user']['imageURL'];
        $_SESSION['clubURL'][] = $v['user']['clubURL'];
        $_SESSION['id'][] = $v['id'];
        $_SESSION['date'][] = $v['date'];
        $_SESSION['description'][] = $v['description'];
        $_SESSION['byPhone'][] = $v['byPhone'];
        $_SESSION['totalPage'][] = $v['totalPage'];
        $_SESSION['userid'][] = $v['user']['id'];
        $_SESSION['accountlikes'][] = $v['account']['likes'] . ")";
        $_SESSION['accountdislikes'][] = $v['account']['dislikes'] . ")";
        $_SESSION['accountcommentes'][] = $v['account']['commentes'] . ")";
        $_SESSION['accountshares'][] = $v['account']['shares'] . ")";
        $_SESSION['accountclicks'][] = $v['account']['clicks'] . ")";
    }
    

    And to get a list of the $_SESSION array, use print_r($_SESSION); or var_dump($_SESSION);.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The JavaScript code window.print() can print the current HTML page. If I have a
In R, how can I print a character list from A to Z? With
I can print out a date nicely based on the user's locale. But how
How I can print on UILabel text like this m³? Thanks
I'm using QWINSTA.EXE to get the session/user list from a terminal server on our
provided that I have two lists in same length, list_a, list_b. I can print
can some one point out the problem with this code? It supposed to fetch
I have set up a shopping basket which is a session list is stored
I'm trying to print a list of values that I've stored in a session-variable
I have a list of String and i set it into a session: session.setAttribute(datas,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.