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

  • Home
  • SEARCH
  • 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 8175701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:52:20+00:00 2026-06-06T22:52:20+00:00

Please i need help, this code below works fine on my localhost, php5.3+ but

  • 0

Please i need help, this code below works fine on my localhost, php5.3+ but on the server its not working fine. 5.2

    $_SESSION['myinv_id'] = $setinvid;
    $_SESSION['prod_name'][$i] = $prod_name;    
    $_SESSION['qty'][$i] = $clean_qty;
    $_SESSION['price'][$i] = $clean_price;
    $_SESSION['total'][$i] = $clean_total;
    $_SESSION['desc'][$i] = $desc;

when i did a var_dump

The first time contents were added, i had these.

    array(5) { 
     ["prod_name"]=> array(1) {[0]=> string(4) "SDFD" }
     ["qty"]=> array(1) {[0]=> string(2) "43"} 
     ["price"]=> array(1) { [0]=> string(2) "43" } 
     ["total"]=> array(1) { [0]=> string(4) "1849" } 
     ["desc"]=> array(1) { [0]=> string(6) "dsfsdf" } } 

works fine….as the array is returned but in an attempt to added a second value…i get these error…saying Fatal Error [] not expected for strings..when i did a var_dump…i had these…in these case, [‘prod_name’] & [‘desc’] has inevitable changed from array to string and an array value cannot be pushed into the stake.

    array(5) { 
     **["prod_name"]=> &string(5) "dddsd"** 
      ["qty"]=> &array(2) { 
        [0]=> string(2) "43" 
       [2]=> string(2) "45" }
       ["price"]=> &array(2) { 
  [0]=> string(2) "43" 
     [2]=> string(1) "3" } 
     ["total"]=> &array(2) { 
[0]=> string(4) "1849" 
        [2]=> string(3) "135" } 
      **["desc"]=> &string(7) "dsddadd"** } 

Please what could be the source of the problem, and i have even tried decalaring this session variables as an empty array before using them, yet no avail.

  • 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-06-06T22:52:22+00:00Added an answer on June 6, 2026 at 10:52 pm

    Your question seems to be why is my session array mysteriously being modified all by itself?

    If the php config has register_globals enabled, then, $var and $_SESSION['var'] become the same variable(via references). This can lead to some real code wtf’s because assigning a value to $var also assigns the value to $_SESSION['var']

    I can’t remember, but the reference between the two variable may only be established when session_start is called. Also, I would imagine this only occurs in the global scope.

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

Sidebar

Related Questions

Please i need someone to help convert this query entity(c#) form. select * from
I need some help to get this right, please. I have created an iPad
I need some help with a LINQ query in VB.Net, please. I have this
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Please, I need help with my code: def start(): def start_tkinter(): global main,l main.destroy()
The code below kinda works except yes.com is shown as valid while I need
i really need some help on this. I searched the internet but couldn't find
I'm new to this ExpandableListView and I desperately need your help please. I'm using
I need some help with floating point numbers...please! Here's the thing, I have code
I have created a WebView programmatically. This works perfect. The code is below. What

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.