If you know the variable name that would store the connection resource, I suppose you could get anal about it and so something like:
if(
isset($connx)
and is_resource($connx)
and strpos(strtolower(get_resource_type($connx)), 'mysql') !== false
) {
echo "You are connected to MySQL";
}
else
{
echo "Oops, not connected.";
}