Re: Questions on PHP Variables

From: Date: Sun, 10 Nov 2002 14:52:04 +0000
Subject: Re: Questions on PHP Variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-123693@lists.php.net to get a copy of this message
At 15:28 10.11.2002, Ray Seals said: --------------------[snip]-------------------- >Parse error: parse error, expecting 'T_STRNG' or 'T_VARIABLE' or >'T_NUM_STRING' in <blah, blah, blah> on line 33. > >Here is the script that is doing this: > > [...] > > $sql = "SELECT * > FROM users > WHERE username='$_SERVER["PHP_AUTH_USER"]' and >password='$_SERVER["PHP_AUTH_PW"]'"; --------------------[snip]-------------------- You need to put the array dereference in curly brackets: $sql = "SELECT * FROM users WHERE username='{$_SERVER['PHP_AUTH_USER']}' and password='{$_SERVER['PHP_AUTH_PW']}'"; Note that I used single quotes within the array - it's for the paranoid like me only, it's a few nanosecs faster :) -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#123693) next »