In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Steve Brett) wrote:

> 'invalid index test assumed 'test' in test.php at line 13' .... can't
> remember the exact syntax but that's the general idea.
> 
> if i quote the var when i reference it the error goes away. like
> $arow['test'] as opposed to $arow[test].
> so in general i quote them always BUT i tried to set up a php members board
> on my server yesterday using someones elses code (blazeboard) and got
> hundreds of these errors whihc leads me to believe it's either my php or
> mysql setup ...

Strictly speaking, these are not supposed to be the same thing:

$myarray[index]  //key uses the value of a constant named "index"
$myarray['index'] //key is the literal string "index"

It's a PHP warning that you're getting.  Because it's an informational 
error rather than fatal, the parser continues on as long as it can find an 
element with that same name (even though it's looking first for the 
constant).  If there's any danger of there being confusion between a 
constant and array element with the same name, then you need to correct the 
quoting.  If you set your error_reporting level lower (you probably have it 
at E_ALL now) the warning will no longer appear; but understand that it'll 
still be *occuring*--it's just that you just won't be reminded of that fact 
anymore.  So you still need to watch what you name those constants and 
keys!  (And in the future, get in the habit of quoting keys correctly so 
there's no room for confusion.)

-- 
CC

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to