Check whether mysqli connection is made or not in php
Check whether mysqli connection is made or not in php
This function helps to check whether connection the mysql server has been made or not.Here is the code:
if ($mysqli->ping()) {
echo ("Our connection is ok! ");
} else {
printf ("Error: %s ", $mysqli->error);
}
The $mysqli variable is a connection made via mysqli function.
Know more about mysqli ping function here.
No comments:
Post a Comment