Re: wrong value from define
| From: | Daniel Schierbeck | Date: | Wed, 29 Dec 2004 14:44:36 +0000 |
| Subject: | Re: wrong value from define | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205298@lists.php.net to get a copy of this message | ||
Arthur wrote:
Hi, in the following code, i want to get a constant value from config.php. I don't receive the value, that is defined, but the name of the constant. I tested the defines in config.php by echoing all defines, and it was allright, so i'm quite confused why it doesn't work here. That's my piece of code (which is in a class in a file which is in the same dir as config.php): function reg($name, $pw, $ally, $act) { include('config.php'); echo(DB_SERV_NAME . '<br>'); $dbp = mysql_connect(DB_SERV_NAME, DB_USR_NAME, DB_PW); if(!$dbp) die ("MySQL-Fehler"); Thats my error message: Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host 'DB_SERV_NAME' (11001) in C:\apachefriends\xampp\htdocs\alliance\script\cl.member.php on line 34 MySQL-Fehler Normally, i should get 'localhost'. Anyone who can help me? place this at the top of the file: error_reporting(E_ALL);Either you don't define the consatnts properly or the include file doesn't exist.