Change to this. It is already declared, just pass it to the connection.
function get_connectivity($pwd){
$host = "localhost";
$user = "root";
$database = "testing";
$db = new mysqli($host, $user, $pwd, $database);
if ($db->connect_errno) {
return false;
exit();
}
$db->close();
return true;
}