Reputation: 173
So my problem/question is i'm coding a irc bot and that bot make some request to sql but some times i need to restart the mysql and script losse the connection and display. PHP Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result
I already tried to use "connection_aborted()" but it always return 0 tested with connected script and disconnected script i'm trying to check when he dc's to auto reconnect again but that function keep returning 0
Upvotes: 2
Views: 79
Reputation: 2003
You can use this
$link=mysqli_connect('localhost','root','','dbname');
$ping=mysqli_ping($link);
if ($ping) {
printf ("mysqli is connected");
} else {
printf ("mysqli is NOT connected");
}
Upvotes: 1