This question already has an answer here:
- Check if db connection is closed - php 4 answers
I have the following class method -
class Someclass
{
/* Other properties and methods */
public function close_connection($connection=NULL)
{
return mysql_close($connection)
}
}
Now, before calling the mysql_close
function in the above code, I want to check if the $connection
points to a open database connection. That is, I want to be sure that the connection I am closing is open and has not already been closed.
How can I do that?
</div>