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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:05:58+00:00 2026-06-15T09:05:58+00:00

In my PHP codes, I always have this problem that I can not use

  • 0

In my PHP codes, I always have this problem that I can not use include somewhere!

For e.g. I’m using MySQL to connect to my database and I made a global.php to include & connect to my database and use it for all other PHP files.

But somewhere I keep getting the error:

Fatal error: Cannot redeclare connect() (previously declared in C:\xampp\htdocs\mypm\functions\global.php:4) in C:\xampp\htdocs\mypm\functions\global.php on line 7

I can not include or use some files that uses global.php in other PHP files!

Any suggestions? Thanks

Here is the code

require ('users.php'); function get_gravatar($id) { $email = get_email($id); $s = 80; $d = 'mm'; $r = 'g'; $img = false; $atts = array();
$url = 'http://www.gravatar.com/avatar/'; $url .= md5( strtolower( trim($email) ) ); 
$url .= "?s=$s&d=$d&r=$r";
    if ( $img ) {
       $url = '<img src="' . $url . '"'; foreach ( $atts as $key => $val ) $url .= ' ' . $key . '="' . $val . '"'; $url .= ' />'; } return $url; 
    }
  • 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-15T09:05:59+00:00Added an answer on June 15, 2026 at 9:05 am

    PHP has alternate versions of include() and require() which address this problem. Use include_once() or require_once() for files which might be included from multiple files to prevent the common file from being included in your code multiple times.

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

Sidebar

Related Questions

I have experienced about two times that mysql database crashes and it can not
I am using php and i have written codes to allow a user upload
I can't seem to figure this one out. I have a validator-type script that
I am using following PHP code for trigger creation but always get error, please
Why does this code always return 0? var possibleMatches = new Array(); $.getJSON('getInformation.php', function(data)
I want obtain full URL adres in php script, tell please, this code always
As a PHP developer, I always use the code below whenever I want to
When I run this code: >> I = imread('D:\Works\matlab\SecCode.php.png','png'); >> imshow(I); It always shows
How can I write php codes independent from XHTML codes?
I created an Archive list ( also this is my archive.php codes ) on

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.