display block and connection troubles

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

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Undefined index notices come from not wrapping your array index in quotes. It is a common error made by newer developers. This:

Code: Select all

$array_val = $array[index];
should be:

Code: Select all

$array_val = $array['index'];
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

it got rid of the "Use of undefined constant op" but the undefined index one is still there
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That means you are referencing an array var that has not been set yet. Like if you did this:

Code: Select all

$myarray = array();

echo $myarray['yellow'];
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

if im understanding the error and what your saying correctly...the error is being given because "op" doesnt have an initial value but if i were to give it a value...what would its init be? how would i go about setting it....the tutorial is the first scrip i posted...it dosent include a initial value for the op array....and/or dosent have it set to anything...i just assumed it didnt need to be
Post Reply