multi_query($newquery); // MultiQuery is NON-Blocking,so wait until everything is done do { null; } while ($mysqli->next_result()); $result = $mysqli->store_result(); // Close the connection $mysqli->close(); return true; } function database_check($data) { try { $timeout = 5; /* five seconds for timeout */ $link = mysqli_init(); $link->options(MYSQLI_OPT_CONNECT_TIMEOUT, $timeout); $link->real_connect($data['db_hostname'], $data['db_username'], $data['db_password'], $data['db_name']); if ($link->connect_error) { throw new Exception('Connection Error: ' . $link->connect_error); } $mysql_version = $link->server_info; $link->close(); return $mysql_version; } catch (Exception $e) { return 'Error: ' . $e->getMessage(); } } }