Announcement

Collapse
No announcement yet.

PHP Warning: mysql_close(): 33 is not a valid MySQL-Link resource

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Warning: mysql_close(): 33 is not a valid MySQL-Link resource

    I have a small issue. Periodically when I try to close a database connection I get a PHP warning of:

    PHP Warning: mysql_close(): 33 is not a valid MySQL-Link resource
    here is the code:

    Code:
    function DBclose($c){
        if (isset($c) && !mysql_close($c)){
            error_log("DB handle is invalid/null. Called from ".debug_backtrace()[2]['function'].'->'.debug_backtrace()[1]['function']);
        }
    }
    How do I fix this problem?

  • #2
    You need to check if it's a resource using is_resource()

    Comment


    • #3
      You can use debug_backtrace function to get parent function calls.

      Comment

      Working...
      X