Page 1 of 1

Undefined offset

Posted: Fri Jan 16, 2009 11:38 pm
by Todlerone
Hello everyone and TGIF if it fits. Thank-you in advance for any help/suggestions. I've created a function that takes in passed variables and is supposed to populate an array for me. I have echoed all my variables and they do exist. My problem is when I try to assign a value to the array I get "Undefined offset: 7".

Code: Select all

$standings[$V][2]+=1;
The $V variable is correctly set (in this case it is 7).

CHEERS

Re: Undefined offset

Posted: Fri Jan 16, 2009 11:55 pm
by requinix
Before that statement do a

Code: Select all

print_r($standings);
Whatever you may say, $standings[7] doesn't exist.

Re: Undefined offset

Posted: Sat Jan 17, 2009 12:23 am
by Todlerone
tasairis wrote:Before that statement do a

Code: Select all

print_r($standings);
Whatever you may say, $standings[7] doesn't exist.

It says Array() and that's all..

Re: Undefined offset

Posted: Sat Jan 17, 2009 12:27 am
by requinix
Todlerone wrote:It says Array() and that's all..
Then it's empty. There's nothing in it. Means there's a mistake earlier in the code.

Does this code happen to be inside of a function? Where is $standings coming from?

Re: Undefined offset

Posted: Sat Jan 17, 2009 8:07 am
by Todlerone
Yes it is inside a function.