Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't Use String Offset as An Array

Status
Not open for further replies.

fergmj

Programmer
Feb 21, 2001
276
US
Hey guys, I am seeing an error in my PHP5

The error is "Cannot use string offset as an array"

Here is a piece of the code. The line where the error occurs is
Code:
$country_codes['us'] = $price_array[$arr['us_masterid']]['sellers'];

Code:
 if ($res_map && db_numrows($res_map))
   {
     $arr = db_fetch_array($res_map, 0);
     if ($country_domain == "ca" && ($nr+$nr_enduser)>0)
       {
       $ret_info = 1;
       $us_masterid = $arr['us_masterid'];
       $retid_limit_sql_current = $retid_limit_sql;
       $exclusive_cobrand_current = $exclusive_cobrand;
       $retid_limit_sql = get_partner_rules(1);
       $exclusive_cobrand = preg_match('/not in/i',$retid_limit_sql);
       $price_array = getPrice(array($arr['us_masterid']),'M',1);
       $retid_limit_sql = $retid_limit_sql_current;
       $exclusive_cobrand = $exclusive_cobrand_current;
       $country_codes['us'] = $price_array[$arr['us_masterid']]['sellers'];
       }

I would greatly appreciate any feedback.

Thank you
 
It appears one of you arrays is not really an array but a string.

And you are trying to change the value of one of the strings characters into an array.

To be sure we'll need to know what the getPrice() function does.

Is it really returning an array, and if it is, would that array really contain an index $_arr['us_masterid'] that was already used to generate it?

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
i suspect the error message is misleading and in fact it is because this
Code:
$arr['us_masterid']
is in fact an array itself and you are trying to use it as a string offset for another array.

but i could be wrong ... we'll need answers to vacunita's questions to be sure
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top