user2942910
user2942910

Reputation: 173

PHP Mysql Aborted Function

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

Answers (1)

Farhad
Farhad

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

Related Questions