I am having a problem defining these constants on my localhost:

define ('BASE_URI','C:\wamp\www\shop\\');
define ('BASE_URL','http://localhost/shop/htdocs/');
define ('MYSQL','BASE_URI/.mysql.inc.php');

How exactly do I define BASE_URL, and BASE_URL using wamp which is located i the C directory.

This gives me an 500 Internal Server Error.

Regards, Klemme

You might want to use the $_SERVER variable for that.
it's more flexible incase you need to move it to an other server

I still get an error though, but now 404 not found - so i guess i have improved it..

My directory structure is like this:

Outside the web root directory is my mysql.inc.php:

// Database constants definition:
define ('DB_HOST','localhost');
define ('DB_USER','root');
define ('DB_PASSWORD','');
define ('DB_NAME','shop');

// Oprettelse af forbindelse:
$dbc = mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);

// Definer carachter set:
mysqli_set_charset($dbc, 'utf8');

And then the site is inside a directory called htdocs.
Inside htdocs I have the following directory structure: only showing a few

-> includes (inside this I have a file called config.inc.php - which looks like this)
And this is where I want to create the constants:

define ('BASE_URI',''.$_SERVER['DOCUMENT_ROOT'].'');
define ('BASE_URL','http://localhost/shop/htdocs/');
define ('MYSQL',BASE_URI.'mysql.inc.php');

And then in my index.php file, i want to include the config.inc.php - and establish the db connection, but i am screwing it up:

index.php:

<?php require('./includes/config.inc.php'); ?>
<?php require(MYSQL); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Nevermind it is working now - I typed the wrong url...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.