I have three different classes which i use on a certain php page to extract some data from my database. Each class does it's own connect procedure using PDO. How can i check if a connection is already established to mysql using pdo ? My connection code is below:
try
{
$DB_con = new PDO("mysql:host={$db_host};dbname={$db_name}",$db_user,$db_pass);
$DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$DB_con->exec("SET CHARACTER SET utf8");
}
catch(PDOException $exception)
{
echo $exception->getMessage();
}