Re: mysql errors .... or php errors ????

From: Date: Thu, 28 Jun 2001 19:08:58 +0000
Subject: Re: mysql errors .... or php errors ????
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-9956@lists.php.net to get a copy of this message
In article <4E6344D9E3797749A18AC8017B88181E11602A@sv-pdc.EMIS.LOCAL>, steve.brett@e-mis.co.uk (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

« previous php.db (#9956) next »