is there a function that checks whether there's an active connection to a MySQL server?
Yes.
[man]mysql_ping/man
Thanks.
Marked resolved.