Re: Notice:Use of undefined constant

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

 



On Saturday 22 January 2005 06:20, Tamas Hegedus wrote:

> In a file, which is included into all my scripts, I defined constants
> (for MySQL access). PHP claims these constants as undifined constants,
> however, if I let them print out they have the right values
> (HOST='localhost'; NOT: HOST='HOST').

Where do you print them out? In the file in which they're defined or somewhere 
else?

> The output of my script:
> ----
> PHP Notice:  Use of undefined constant HOST - assumed 'HOST' in
> /home/hegedus/bin/hae_chng.php on line 4

This suggests that your file containing the constants definitions was not 
included. Which means you're not going to be able to connect to mysql (unless 
by some fluke that your host happens to be 'HOST', etc).

> One solution could be to suppress php notices, but I think this is not
> the right treatment. Do you have any idea?

Suppressing notices/warnings/errors is never a solution. The solution is to 
not give them an excuse in appear in the first place.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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