$db = mysqli_connect($db_host, $db_user, $db_password, $db_name);
function db_connect(){
$db = mysqli_connect($db_host, $db_user, $db_password, $db_name);
}
$db = db_connect();
$res = mysqli_query("SELECT `id` FROM `tokens` WHERE `token` = '$token'");