Answer the question
In order to leave comments, you need to log in
Why doesn't adding to the database work?
Tell me why when using the code below, the addition does not work, but simply remains unchanged? php version 7.4
$title = $_POST['title'];
$get_id = $_GET['id'];
if(isset($_POST['add'])){
$sql = ("INSERT INTO xf_category (title) VALUES (?)");
$query = $pdo->prepare($sql);
$query->execute([$title]);
if($query){
header("Location: ". $_SERVER['HTTP_REFERER']);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question