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 8103135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:26:57+00:00 2026-06-05T23:26:57+00:00

I really have no idea what I did to cause this exception, but I

  • 0

I really have no idea what I did to cause this exception, but I have deduced that this problem is occurring only because I am including a PHP script. Here is the error it is throwing:

[Tue Jun 19 01:33:28 2012] [error] [client 127.0.0.1] PHP Fatal error:  Cannot redeclare sql_connect() (previously declared in core.php:6) in core.php on line 9

Here is sql_connect():

function sql_connect(){
    $a = mysql_connect("localhost", "user", "pass") or die(json_encode(array("failure"=>"SQL CON FAILURE: ".mysql_error()))); // Line 6
    mysql_select_db("whoSync", $a);
    return $a;
} //Line 9

More background: core.php is not actually running any code, it merely defines functions. Now here is why it is weird: when I include core.php in home.php it throws that exception above. Including core.php in any other file will not result in an error.

I am really good with PHP, but I have no idea what is happening. Thanks for any help.

  • 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-06-05T23:27:00+00:00Added an answer on June 5, 2026 at 11:27 pm

    Change your include to include_once or require_once.

    The issue is that you are calling/including a file multiple times which contains a function. The fatal error is thrown to prevent the function from being defined twice.

    Explanation:

    By using the *_once, PHP will only include the specified file once during the execution of the script. PHP does not support Method overloading (outside of the class scope) due to it’s dynamic nature. A language like Java supports Overloading/Overriding of methods.

    Let’s say you have a file called home.php, about.php and sidebar.php. All three files call another file, database.php, which has a function called dbhandler().

    dbhandler() has already been defined. If home.php is called, and it references sidebar.php, then database.php will be called twice. Using include_once/require_once, will only include database.php if it has not yet been called.

    Hope this helps.

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

Sidebar

Related Questions

I have a really hard time searching for this, because I have no idea
This is not a programming question but I have no idea why I did
I really have only a fair idea of what I am doing. Sorry. This
I really have no idea why I'm struggling with this so much. I'm scraping
I really have no idea how to go about this. So far all I
I have really no idea why I'm asking this as this a really completely
I really have problem with this one. So I have a jar with a
I have a really weird situation. The idea is there is a scroller that
I really have no idea why this is happening... I created a win32 application
I really have a problem, I have a VS 2010 solution and it suddenly

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.