I'm having serious problems with INSERT
of PDO
, I can not add values correctly to banco de dados
, how do I do this?
Ilookforwardtohelpingyou.
<?phpif(isset($_POST['btn-send-ticket'])){$name=filter_input(INPUT_POST,'name');$subject=filter_input(INPUT_POST,'subject');$categorys=filter_input(INPUT_POST,'category');$prioritys=filter_input(INPUT_POST,'prioritys');$message=filter_input(INPUT_POST,'message');if(empty($subject)){$error[]='The<strong>subject</strong>fieldcannotbeempty';}elseif(empty($message)){$error[]='The<strong>message</strong>fieldcannotbeempty';}else{try{$sqli="INSERT INTO member_ticket (name, subject, category, priority, message, date, status) VALUES (:name, :subject, :category, :priority, :message, NOW(), 0)";
$insert = $db->prepare($sqli);
$insert->bindParam(":name", $name, PDO::PARAM_STR);
$insert->bindParam(":subject", $subject, PDO::PARAM_STR);
$insert->bindParam(":category", $categorys, PDO::PARAM_STR);
$insert->bindParam(":priority", $prioritys, PDO::PARAM_STR);
$insert->bindParam(":message", $message, PDO::PARAM_STR);
$insert->execute();
$success[] = 'Your support request has been successfully opened, will soon be answered thanks.';
} catch (PDOException $e) {
echo $e->getMessage() . '<br/>' . $e->getLine();
exit;
}
}
}
?>