connect(); if (is_numeric($_REQUEST['id'])) { $query = "UPDATE links SET clicks=clicks+1 where id=" . $_REQUEST['id']; $db_config->execute($query); $row = $db_config->fetchOne("SELECT * from links WHERE id=" . $_REQUEST['id'] . ""); } header("Location: " . $row['link']); ?>