[PHP] Re: wrong value from define

2004-12-30 Thread Arthur
 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.

Well, I tested the constants by another script and they were fine and i
tried it with an non-exisitng file and there was an error message, thus this
file is found.
By the error_reporting i get follwing message:
Notice: Use of undefined constant 'DB_SERV_NAME' - assumed 'DB_SERV_NAME'...
That message occurs for every constant used in the mysql_connect statement.

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



[PHP] Re: wrong value from define

2004-12-29 Thread Daniel Schierbeck
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.

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