Re: Notice:Use of undefined constant

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

 



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?
I was wrong. In my test scritp I do not include any other file, just define the constants, and print them out.

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).
This could not happen, since I did not inserted any other file in my test script.

===========
But now I run the test script on my local machine without any notice.
My php -v:
PHP 4.3.2 (cgi), Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

The script:
---------------
<?php

//-- Ez a teszt
define( HOST, 'localhost');
define( USER, 'hae');
define( PWD, 'hae');
define( DB, 'haetest');

echo 'Host/User/db: ' . HOST . USER . DB;
exit;

/*-- Ez az eredeti
define( HOST, 'localhost');
define( USER, 'h');
define( PWD, 'h');
define( DB, 'hae');
*/

$link = mysql_connect( HOST, USER, PWD);
mysql_select_db( DB);
...

Thanks,
Tamas

--
Tamas Hegedus, Research Fellow | phone: (1) 480-301-6041
Mayo Clinic Scottsdale         | fax:   (1) 480-301-7017
13000 E. Shea Blvd             | mailto:hegedus@xxxxxxxx
Scottsdale, AZ, 85259          | http://hegedus.brumart.org

--
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