prepare('SELECT * FROM anunciosh WHERE registro = :Fecha'); $sql->execute(array(':Fecha' => $noregistro)); $result = $sql->fetchAll(); foreach ($result as $Rs) { $adonde=$Rs["link"]; } $sqla = $db->prepare("INSERT INTO clicksh (registro, fecha, app) VALUES (:Reg, :Fechaa, :APP)"); $sqla->bindParam(':Reg', $noregistro); $sqla->bindParam(':Fechaa', $hoy); $sqla->bindParam(':APP', $where); $sqla->execute(); header("location: $adonde"); ?>