2013-10-06, 09:52 PM
I am completely stumped at why I am getting a PHP Warning in my code. I have tried all sorts to fix it, but still nothing. The code works standalone without MyBB in Codeigniter, I have just ported it across to MyBB.
Basically I have a multidimensional array along the lines of:
My for loop looks like this:
I managed to get it outputting one item (baring in mind I have hidden a lot in the array above). However I get a warning with:
I have Googled the error and try putting in measures such as:
But I still have the error. It's pretty confusing seeing as it works outside MyBB.
Any help is appreciated.[/code]
Basically I have a multidimensional array along the lines of:
Array
(
[status] => success
[items] => Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[name] => 'Test Item'
)
)
[1] => 1
)
)
My for loop looks like this:
for($i_item = 0;$i_item < $return_array['items'][1];$i_item++)
{
}
I managed to get it outputting one item (baring in mind I have hidden a lot in the array above). However I get a warning with:
Quote:Warning [2] Illegal string offset 'items' - Line: 49 - File: C:\xampp\htdocs\mybb\steam.php PHP 5.4.16 (WINNT)
I have Googled the error and try putting in measures such as:
if(is_array($return_array['items']) and !empty($return_array['items'])
if(isset($return_array['items'][$i_item]))
But I still have the error. It's pretty confusing seeing as it works outside MyBB.
Any help is appreciated.[/code]