Re: wrong value from define
| From: | Arthur | Date: | Wed, 29 Dec 2004 23:39:26 +0000 |
| Subject: | Re: wrong value from define | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205332@lists.php.net to get a copy of this message | ||
> Hello Arthur,
>
> Wednesday, December 29, 2004, 12:37:30 PM, you wrote:
>
> A> That's my piece of code (which is in a class in a file which is in the
same
> A> dir as config.php):
>
> A> function reg($name, $pw, $ally, $act) {
> A> include('config.php');
> A> echo(DB_SERV_NAME . '<br>');
> A> $dbp = mysql_connect(DB_SERV_NAME, DB_USR_NAME, DB_PW);
> A> if(!$dbp) die ("MySQL-Fehler");
>
> Show us the define statements? The code above is fine, assuming that
> it could find config.php of course (swap it for a require to get a
> fatal error).
>
> Best regards,
>
> Richard Davey
> --
Hello,
the config file is like this:
<?php
define('DB_SERV_NAME', 'localhost');
//some more identical constants
?>
I gave a non-existing include-file as well, and there was the mistake, as
usually. I also tried to solve the problems by using variables (e.g.
$DB_SERV_NAME = 'localhost';), but the same result occured as with the
defines.
Is it possible, that it has to do with the class? Or that it is something
about PHP 5 (i'm working with it)?
> place this at the top of the file: error_reporting(E_ALL);
I'm going to try, thanks.
Arthur