Undefined Offset

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bmerz
Forum Newbie
Posts: 2
Joined: Tue Oct 29, 2002 8:36 am
Location: U.K, London

Undefined Offset

Post by bmerz »

I am writing some code that takes indexes of an array and then places them on a website in a specific format, pretty simple, but when i try to access the array by using a variable index i get a notice that says

Undefined Offset: 43

i am not sure why this is because it works all the other times i try it in the code preceding it, just in two spots. Here is the code:

(comes at the end of a while loop after $i has been incremented)

Code: Select all

if ($thearrayї$i]ї'7'] != 'Systech')
{
	$is_sys = 0;
}
else if ($thearrayї$i]ї'7'] == 'Systech')
{
	$is_sys = 1;
}

$week_curr = $thearrayї$i]ї'0'];
Any ideas would be appreciated.

thanks,
brian;
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

$i has incremented up to 43 and there is no $thearray[43] element. To see exactly what is in $thearray (for debugging purposes) do:

Code: Select all

echo '<pre>';
print_r($thearray);
echo '</pre>';
Mac
bmerz
Forum Newbie
Posts: 2
Joined: Tue Oct 29, 2002 8:36 am
Location: U.K, London

fixed

Post by bmerz »

hey thanks, i just made a silly mistake that was no where that i was looking....just had to subtract the number of times i was running the loop by one.

thanks for the help,
brian;
Post Reply