$visitado=$_GET["id"]; // marcas el click (update tutabla set clicks=clicks+1 where ID=$visitado) // haces el query (select URL from tutabla where ID=$visitado) header("Location: $url_del_query");