prepare($sql); $stmt->bindParam(1, $_GET['token']); if ($stmt->execute()){ if ($stmt->rowCount() == 1){ $sql = "select user from tokens where token=?"; $stmt = $pdo->prepare($sql); $stmt->bindParam(1, $_GET['token']); if ($stmt->execute()){ $uid = $stmt->fetchAll(PDO::FETCH_ASSOC)[0]['user']; if (isset($_POST['name'])){ $sql = "INSERT INTO `workout_routines`(`creator`, `title`, `public`) VALUES (?,?,0)"; $stmt = $pdo->prepare($sql); $stmt->bindParam(1, $uid); $stmt->bindParam(2, $_POST['name']); if ($stmt->execute()){ echo 'sucess'; }else{ var_dump($stmt->errorInfo()); } } } } } }