Jump to content

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.