php – SQLSTATE [23000]:完整性约束违规:1048列’post’不能为null

我有这个代码但是当我尝试这些代码时,我得到了:

sqlSTATE[23000]: Integrity constraint violation: 1048 Column ‘post’ cannot be null
this error.

我找不到任何解决方案.我尝试了另外的功能,这些功能是他们工作的但是这个功能不起作用.

?>
<form method="post">
Buraya yaz <br><textarea style="resize:none" name="post"></textarea> <br><input type="submit" value="Gönder">
</form>

<?PHP 
if(empty($_POST['post'])){
echo 'you should fill the area.';
exit;
}
if (empty($errors) === true) {
$users->sendpost($post);
}
?>

public function sendpost($post){
$query  = $this->db->prepare("INSERT INTO `posts` (`post`) VALUES (?) ");
$query->bindValue(1, $post);
try{
$query->execute();
}catch(PDOException $e){
die($e->getMessage());
}   
}

解决方法:

insert $post = $_POST [‘post’];

$post = $_POST['post'];

if(empty($_POST['post'])){
echo $errors[] = 'you should fill the area.';
}
if (empty($errors) === true){
$users->sendpost($post);
}

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...