<?php session_start(); include "../db_connect.php"; if(!isset($_SESSION['user_id']) || !isset($_POST['following_id'])){ header("location: ../index.php"); } $follower_id = $_SESSION['user_id']; $following_id = $_POST['following_id']; $username = $_POST['username']; if($following_id == $follower_id){ die("Geht nicht Amk"); } try { $stmt = $pdo->prepare("INSERT INTO followers (follower_id, following_id) VALUES (:follower_id, :following_id)"); $stmt->execute(['follower_id' => $follower_id, 'following_id' => $following_id]); header("location: ../profile.php?user=".$username); } catch(PDOException $e){ echo $e->getMessage(); }