Re: [PHP] what's undefined index ?
Your message of Tue, 26 Mar 2002 11:46:28 +1100: Undefined offset- numeric index doesn't exist Haven't seen one of these yet, but thanks for the warning ;-) Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what's undefined index ?
Your message of Mon, 25 Mar 2002 11:35:57 +1100: undefined variable is when you try to use a variable before you set it, eg $foobar undefined index is when you try to reference an array index before you set it, eg $foobar[10] Hi, thank you both for the explanation. It's clear why I get the undefined, these variables *are* for various reasons undefined at the moment. However, there are NO arrays involved, f.i. KundeRemark is NOT an array it's a simple string variable created by $KundeRemark = stripslashes($val[KundeRemark]); which is a field from a SQL result which currently doesn't exist because I changed the connection to a different db where this field is named differently. So, it's undefined, fine. But why is it called undefined index where it should be undefined variable ? Warning: Undefined index: KundeRemark in C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line 138 Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what's undefined index ?
Good day, The error message refers to the KundeRemark in $val[KundeRemark], not $KundeRemark which you are trying to assign the result to. The former is (if it existed) an index, the latter is a variable. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Kai Schaetzl [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 9:31 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] what's undefined index ? Your message of Mon, 25 Mar 2002 11:35:57 +1100: undefined variable is when you try to use a variable before you set it, eg $foobar undefined index is when you try to reference an array index before you set it, eg $foobar[10] Hi, thank you both for the explanation. It's clear why I get the undefined, these variables *are* for various reasons undefined at the moment. However, there are NO arrays involved, f.i. KundeRemark is NOT an array it's a simple string variable created by $KundeRemark = stripslashes($val[KundeRemark]); which is a field from a SQL result which currently doesn't exist because I changed the connection to a different db where this field is named differently. So, it's undefined, fine. But why is it called undefined index where it should be undefined variable ? Warning: Undefined index: KundeRemark in C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line 138 Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what's undefined index ?
$KundeRemark = stripslashes($val[KundeRemark]); ^^^ \ This is fine, you're assigning TO this \ It's this bit that's undefined as you said: which is a field from a SQL result which currently doesn't exist... so, in a way, you answered your own question. HTH Martin -Original Message- From: Kai Schaetzl [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 3:31 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] what's undefined index ? Your message of Mon, 25 Mar 2002 11:35:57 +1100: undefined variable is when you try to use a variable before you set it, eg $foobar undefined index is when you try to reference an array index before you set it, eg $foobar[10] Hi, thank you both for the explanation. It's clear why I get the undefined, these variables *are* for various reasons undefined at the moment. However, there are NO arrays involved, f.i. KundeRemark is NOT an array it's a simple string variable created by $KundeRemark = stripslashes($val[KundeRemark]); which is a field from a SQL result which currently doesn't exist because I changed the connection to a different db where this field is named differently. So, it's undefined, fine. But why is it called undefined index where it should be undefined variable ? Warning: Undefined index: KundeRemark in C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line 138 Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what's undefined index ?
Your message of Mon, 25 Mar 2002 09:39:06 -0700: The error message refers to the KundeRemark in $val[KundeRemark], not $KundeRemark which you are trying to assign the result to. The former is (if it existed) an index, the latter is a variable. Oh, yeah, I see. Stupid me. Thanks! Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what's undefined index ?
Just a follow up - I've been doing some debugging of my own code and here are the three different errors to do with undefined varariables: Undefined variable - variable not set/declared Undefined offset- numeric index doesn't exist Undefined index - alphanumeric index doesn't exist (I may have missed out on one/some) I didn't think about offset with I sent my first reply to this thread Hope that helps someone Martin -Original Message- From: Kai Schaetzl [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 11:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] what's undefined index ? Your message of Mon, 25 Mar 2002 09:39:06 -0700: The error message refers to the KundeRemark in $val[KundeRemark], not $KundeRemark which you are trying to assign the result to. The former is (if it existed) an index, the latter is a variable. Oh, yeah, I see. Stupid me. Thanks! Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what's undefined index ?
undefined variable is when you try to use a variable before you set it, eg $foobar undefined index is when you try to reference an array index before you set it, eg $foobar[10] -Original Message- From: Kai Schaetzl [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 11:31 AM To: [EMAIL PROTECTED] Subject: [PHP] what's undefined index ? When I enable display of warnings I get an undefined index warning instead of an undefined variable for some variables. Why and what's the difference? Warning: Undefined index: KundeRemark in C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line 138 Warning: Undefined variable: KundeStatusNeu_show in C:\Server\www\conadmin\admin-beta\lib\kunden_functions.inc on line 192 Kai -- Kai Schätzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com IE-Center: http://ie5.de http://msie.winware.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what's undefined index ?
On Monday 25 March 2002 08:35, Martin Towell wrote: undefined variable is when you try to use a variable before you set it, eg $foobar undefined index is when you try to reference an array index before you set it, eg $foobar[10] Just to extend the explanation further. The most common cause of undefined index is the use of unquoted array keys: $doo = array('dah' = 'dib'); echo $doo[dah]; # incorrect, undefined index error echo $doo['dah']; # correct, no error -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Life is a game of bridge -- and you've just been finessed. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php