Jump to content

[SOLVED] constants not getting read


evanct

Recommended Posts

I have some constants defined here in config.php:

 

define('SQL_HOST','localhost');
define('SQL_USER','root');
define('SQL_PASS','a');
define('SQL_DATABASE','fileservice');

 

and I try to use them here:

 

require_once('config.php');
$connection=mysql_connect(SQL_HOST,SQL_USER,SQL_PASS);
mysql_select_db(SQL_DATABASE,$connection);

 

All I get is some "Use of undefined constants" notices. the require_once link is correct and there's nothing wrong with config.php - it's just a bunch of constant definitions between php tags. This has happened before, I just ended up declaring the mysql_connect variables in the mysql connection script.

Link to comment
https://forums.phpfreaks.com/topic/163597-solved-constants-not-getting-read/
Share on other sites

That's really counter-intuitive by the way. if x.php and y.php both include z.php, which includes a.php, shouldn't the link to a.php be relative to z.php? When it's relative to x.php and y.php, and x.php is in a different directory level than y.php, that creates a problem. How do i even work around that?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.