Jump to content

AdamFerguson

New Members
  • Posts

    3
  • Joined

  • Last visited

AdamFerguson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I figured it out, the array was treating $key1 and $key2 as integers and therefore $key1 (which was 202-7465746-2875675) was not being treated as a string as I had hoped. Just wrapped them like this in double quotes: $this->cpc["{$key1}"]["{$key2}"]['ship_phone']
  2. Hi, The code: $key1 = $shipping['orderid'][0]; $key2 = $dbitem['ProductCode']; // store the shipping details for the order $this->cpc[$key1][$key2]['shiptype'] = $shipping['shiptype'][0]; $this->cpc[$key1][$key2]['marketplace'] = $shipping['marketplace'][0]; $this->cpc[$key1][$key2]['ship_name'] = $shipping['ship_name'][0]; $this->cpc[$key1][$key2]['ship_address1'] = $shipping['ship_address1'][0]; $this->cpc[$key1][$key2]['ship_address2'] = $shipping['ship_address2'][0]; $this->cpc[$key1][$key2]['ship_city'] = $shipping['ship_city'][0]; $this->cpc[$key1][$key2]['ship_state'] = $shipping['ship_state'][0]; $this->cpc[$key1][$key2]['ship_postcode'] = $shipping['ship_postcode'][0]; $this->cpc[$key1][$key2]['ship_countrycode'] = $shipping['ship_countrycode'][0]; $this->cpc[$key1][$key2]['ship_phone'] = $shipping['ship_phone'][0]; if you print any of these individually (except any that being with $this->cpc) the value is printed to the screen so I know that everything has a value. Why then, would $this->cpc array not hold any of these values? $key1, $key2, all the $shipping variables all have values when printed. But none are assigned to the $this->cpc array.
  3. Hi, Can someone please help. I have an array such as: $this->cpc[$key1][$key2]['shiptype'] = $value; But when I try to print the value the array is empty: echo $this->cpc[$key1][$key2]['shiptype']; But, if I don't use variable names such as $key1 and $key2 and instead use the values of $key1 and $key2, it works. Such as: (these two lines DO set the value in the array and will print it to the screen) $this->cpc[202-3454-234234][9685766]['shiptype'] = $value; echo $this->cpc[202-3454-234234][9685766]['shiptype']; The $key1 and $key2 DEFINITELY hold the correct values so what is going on here please? Does anyone know? Best Regards, Adam
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.