Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6821183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:30:53+00:00 2026-05-26T21:30:53+00:00

I am doing a little homework assignment in which we are making a very

  • 0

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 that stuff working, only problem is that when I click on the nav link,

I receive this notice:

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

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

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

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

I have a config.php file that I use to establish a DB connection:

<?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();
     } 
?>

Here is the code from the file calling config.php causing this notice:

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

<?php require('footer.php');?>

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:30:54+00:00Added an answer on May 26, 2026 at 9:30 pm

    You’re probably including config.php multiple times. Check all your scripts and find this duplicity. You can use require_once() instead of require() to prevent this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query, which is doing very little and is an example
Hi am just doing a little animation which moves an object from point a
I thought i'd post a little of my homework assignment. Im so lost in
I doing a little jquery+greasemonkey which I'm trying to use to redo an interface
I'm actually doing a little browser which should be able to parse some code,
Doing a little garbage collection here and using a subquery, which I know isn't
Hi I got a little question here. I am doing my C++ homework and
I am just doing a little work this morning making some static libraries. Why
I'm creating a game with points for doing little things, so I have a
im doing a little test to check whether the user is away (unactive) or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.