Why wont this work: '$_SERVER['PHP_AUTH_USER']'
Moderator: General Moderators
Why wont this work: '$_SERVER['PHP_AUTH_USER']'
I am pretty sure I have to have the single qoutes around the text. Its for when I am inserting something into a database.
- hob_goblin
- Forum Regular
- Posts: 978
- Joined: Sun Apr 28, 2002 9:53 pm
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
And if it's in a SQL statement like:
you'll get a parse error, to make it work you need to have either:
or
or
So you can take your pick of syntax.
Mac
Code: Select all
$sql = "SELECT this FROM that WHERE something = '$_SERVER['PHP_AUTH_USER']'";Code: Select all
$sql = "SELECT this FROM that WHERE something = '$_SERVER[PHP_AUTH_USER]'";Code: Select all
$sql = "SELECT this FROM that WHERE something = '{$_SERVER['PHP_AUTH_USER']}'";Code: Select all
$sql = "SELECT this FROM that WHERE something = '".$_SERVER['PHP_AUTH_USER']."'";Mac