Hi!
I'm trying to write a function that'll tell me if the fDatabase instance I'm using is still connected (so I can reconnect if that's not the case), and this is what I have so far:
function IsConnectedToDb(&$db){
$strDbName="my_db";
$boolIsConnected=false;
if(is_object($db)){
if($db instanceof fDatabase){
if($db->getDatabase()==$strDbName){
return true;
}
}
}
return false;
}
(I suspect the & in the declaration might be superfluous, but maybe it could save RAM?)
What this does is check the name of the database, but is that ACTUALLY the same thing as checking if the connection is still alive? Is there a shorter/better/faster way of doing it?
TIA!
Per.