Welcome to WebmasterWorld Guest from 54.147.20.131

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Undefined offset: 1 - what does it mean?

     

royp2000

11:21 pm on Nov 25, 2003 (gmt 0)

10+ Year Member



Hello,

I'm getting the following error when running one of my php scripts:

Undefined offset: 1 in /ftp/virt/techno/classifieds/advertisement.php on line 530

I checked the folowing line (530) and all I had in it was:

$curent_cat_id=$fourth_id_cut[1];

What can cause this error and what does it mean?

Thanks in advance,

Roy

Distel

11:40 pm on Nov 25, 2003 (gmt 0)

10+ Year Member



I found something regarding these errors, which seem to be related to calendars. They suggested a CVS update, whatever the heck that is. ;)

trajan

11:56 pm on Nov 25, 2003 (gmt 0)

10+ Year Member



are you sure that your array-field "$fourth_id_cut[1]" is really set?

in my opinion this notice means that the array value of $fourth_id_cut at key 1 is undefined...

jatar_k

12:04 am on Nov 26, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld trajan,

I was thinking exactly that as well.

royp2000

12:46 am on Nov 26, 2003 (gmt 0)

10+ Year Member



Yea, I'm sure it is set:

529: $fourth_id_cut=explode("=",$third_id_cut);
530:$curent_cat_id=$fourth_id_cut[1];

Any other ideas?

Thanks,

Roy

coopster

12:58 am on Nov 26, 2003 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Try this to make sure:

529: $fourth_id_cut=explode("=",$third_id_cut);
529 1/2: print '<pre>'; print_r($fourth_id_cut); exit('</pre>');
530:$curent_cat_id=$fourth_id_cut[1];

globay

1:05 am on Nov 26, 2003 (gmt 0)

10+ Year Member



are you sure, that there is always a something after "=" in $third_id_cut? If $third_id_cut does not contain =, $fourth_id_cut[1] won't be set.
in $fourth_id_cut=explode("=",$third_id_cut);

And yes, Undefined offset: 1 indicates that $fourth_id_cut[1] is not set

royp2000

9:56 am on Nov 26, 2003 (gmt 0)

10+ Year Member



coopster: I can't enter this line, it causes errors.

globay: Now that you've mentioned it, maybe there is one chance that there is nothing after the "=".

Hmmm... I guess that if I'll enter the following line, it should sove it, isn't it:

$fourth_id_cut=explode("=",$third_id_cut);
if (isset($fourth_id_cut))
{
$curent_cat_id=$fourth_id_cut[1];
}

Thanks,

Roy.

jatar_k

5:21 pm on Nov 26, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



$fourth_id_cut=explode("=",$third_id_cut);
if (isset($fourth_id_cut[1])){
$curent_cat_id=$fourth_id_cut[1];
}

I would think you want to test the 2nd element to see if it is set.

royp2000

11:00 pm on Nov 26, 2003 (gmt 0)

10+ Year Member



o.k I'll try that.

Thanks.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month