Re: Notice:Use of undefined constant
| From: | Jason Wong | Date: | Fri, 21 Jan 2005 23:56:56 +0000 |
| Subject: | Re: Notice:Use of undefined constant | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207011@lists.php.net to get a copy of this message | ||
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