PHP error - Constant DB_HOST already defined?
<p>I am doing a little homework assignment in which we are making a very rudimentary CMS. We are to fill in a form containing title, body, permalink. The CMS then takes the permalink, and adds it to the main nav bar. When that permalink is clicked on the navbar, the title, content,  datestamp created and datestamp modified are to be displayed.
I have this stuff working, only problem is that when I click on the nav link, I have these errors:</p>

<p>Notice: Constant DB_HOST already defined in C:\Program Files\xampp\htdocs\php\assignment_6\config.php on line 2</p>

<p>Notice: Constant DB_USER already defined in C:\Program Files\xampp\htdocs\php\assignment_6\config.php on line 3</p>

<p>Notice: Constant DB_PASS already defined in C:\Program Files\xampp\htdocs\php\assignment_6\config.php on line 4</p>

<p>Notice: Constant DB_NAME already defined in C:\Program Files\xampp\htdocs\php\assignment_6\config.php on line 5</p>

<p>I have a config.php file that i use to establish a DB connection:</p>

<pre><code>&lt;?php
     define('DB_HOST','******');
     define('DB_USER','******');
     define('DB_PASS','******');
     define('DB_NAME','******');  

    $cms_db = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

         if(!$cms_db){
          echo"Could not connect: ".mysql_error();
     } 
?&gt;
</code></pre>

<p>Here is the code from my file that calls the config.php file which is causing the error:</p>

<pre><code>&lt;?php
   require('config.php');
   $perm = $_GET['p'];
   $query = "SELECT * FROM cms WHERE permalink = '$perm'";
   $result = $cms_db-&gt;query($query);
   $row = $result-&gt;fetch_assoc();
   $page_title = $perm;
   require('header.php');
?&gt;
&lt;h1&gt;&lt;?=$row['title'];?&gt;&lt;/h1&gt;
&lt;hr/&gt;&lt;br/&gt;
&lt;p class="para"&gt;&lt;?=$row['content']?&gt;&lt;/p&gt;

&lt;?php require('footer.php');?&gt;
</code></pre>

<p>A small amount of simple code, but what is the problem? It is not a fatal error, but man, is it annoying.</p>
