Welcome Guest, Not a member yet? Register   Sign In
Undefined index
#3

[eluser]Phil Sturgeon[/eluser]
These are both useful points and are indeed things you should do. However the reason for the error message (which was not addressed above) is that you are defining an index in an array that has not been declared.

In C++ or many other languages the debugger would shout names until you bleed, luckily PHP only see's this as a "oh by the way" type warning and is not normally picked up. However CI shows all warnings, therefore ALWAYS define variable types before modifying them.

For example:

Code:
// GOOD
$foo = array();
$foo['something'] = "val";

// BAD
$bar['something'] = "stuff";

Using class variables to do this is one method of doing it, but only required if you are sharing the variable through multiple functions.


Messages In This Thread
Undefined index - by El Forum - 06-30-2007, 09:50 AM
Undefined index - by El Forum - 06-30-2007, 11:22 AM
Undefined index - by El Forum - 06-30-2007, 04:28 PM
Undefined index - by El Forum - 06-30-2007, 11:57 PM
Undefined index - by El Forum - 07-01-2007, 04:16 AM
Undefined index - by El Forum - 07-01-2007, 06:15 AM
Undefined index - by El Forum - 07-01-2007, 10:20 AM
Undefined index - by El Forum - 07-01-2007, 02:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB