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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:29:56+00:00 2026-06-13T10:29:56+00:00

Everyth worked fine, it just decided to stop working and it ruined my whole

  • 0

Everyth worked fine, it just decided to stop working and it ruined my whole project and Im at standstill.

This is error:

mysql_close(): 5 is not a valid MySQL-Link resource in
C:\wamp\www\Includes\footer.php on line 4

This is footer.php

<?php
//close connection
if (isset($dbh)); {
    mysql_close($dbh);
}
?>

This is connect.php

//set constants
require("quick.php");

//database connection
$dbh = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
if (!$dbh) {  //check connection
        die("Cannot conect! to database ");
    }   

//selecting database
$db_select = mysql_select_db(DB_NAME, $dbh);
if (!$db_select) { //check connection
        die("Cannot connect to database ");
    }
?>

Basically whenever I try to quit mysql this error shows.
And it all worked fine not long ago.

  • 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-13T10:29:58+00:00Added an answer on June 13, 2026 at 10:29 am

    Somewhere, within your page, there is an assignment that puts $dbh = 5; that overrides your database connection. That is the cause for the error. Search for any assignments to that variable between your database opening and your footer, and you’ve found your problem.


    Note: I wouldn’t be that worried about the connection being open as some other commenters here, since if it’s not a persistant connection, it will anyway be closed at the end of the script, so I don’t see how that would be ruining your whole project. Your code tries to close it at the footer which is not much different than letting it close itself. From the manual:

    Using mysql_close() isn’t usually necessary, as non-persistent open
    links are automatically closed at the end of the script’s execution.
    See also freeing resources.

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

Sidebar

Related Questions

I am working on this for hours and its driving me nuts! so i
After reading online about hash-bangs. Ive decided to stick with our current url structure.
I'm trying to run jWebSocket server on CentOS 5.8 (1and1 VPS). Just after start
So I have this homework due tommorow. I have to filter every nth element
At the company I work for, I have created a Error Logging class to
I want to write a server side code. It should work with popular browsers
my robotics lab is looking for programmers to work on some projects we have
my first question on Stackoverflow. Let me start with a bit of code. It's
I am web scraping with selenium and whenever i try to download i file
I've learned that iTunes XML file is actually a plist, and instead of trying

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.