why does compiler complain

From: Date: Wed, 20 Dec 2000 21:52:25 +0000
Subject: why does compiler complain
Groups: php.general 
Request: Send a blank email to php-general+get-31324@lists.php.net to get a copy of this message
Hi all, I always define my SQL column names as PHP constants and it always works without complaint until now. I have one example that has been stripped down to almost nothing in which the code works but the PHP compiler complains. It isn't the word "extra"; it doesn't matter what I call the index. Trying to get around it by using "SELECT extra AS any_other_var_name" still fails. the SQL: CREATE TABLE extras ( user_id SMALLINT NOT NULL, extra BLOB, PRIMARY KEY user_id ); the PHP: <?php // database setup include( "connect" ); connect(); // constants define( "_EXTRA_", "extra" ); // the query $resource_id = mysql_query( "SELECT extra FROM extras" ); // the loop while( $row = mysql_fetch_array( $resource_id )) { $some_var = $row[_EXTRA_]; // <--- throws error } // avoid "document contains no data" error print "Done" ?> The error is: Warning: undefined index: extra in test.php on line 15. This is very simple code. Can anyone explain the warning? Thanks again, Mike Wright ps I've gone off-list. Please CC me. thanx

« previous php.general (#31324) next »