Re: help with _get error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 23, 2011 at 10:46 AM, Jack <JackListMail@xxxxxxxxx> wrote:

> I'm having a problem with this line of code which worked fine for years:
>
> $l_url2 = ".".$_GET[SERVER_NAME];
>

Place quotes around the key.

    $l_url2 = ".".$_GET['SERVER_NAME'];

Normally PHP treats SERVER_NAME as the name of a constant. There's a setting
that allows PHP to treat it as a string if there is no constant with that
name, but using that feature has drawbacks and is not good practice. It's
possible that your PHP was upgraded or the setting was disabled.

Either way, there is no downside to using quotes short of two keystrokes
(one if you use a good editor), and you should get used to quoting your
strings.

Peace,
David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux