Hello,
I already try inputing certain information into the blog and form hoping that my input will be place into the database. but I have not seen any text that I input in the database. Can anyone help me fix my codes so that I could input the text in the database. Thanks in advance.
A Database Error Occurred
Error Number: 1048
Column 'date' cannot be null
INSERT INTO `blog` (`date`, `title`, `content`) VALUES (NULL, 'Title', '\r\nContent\r\n')
Filename: C:/Program Files (x86)/EasyPHP-Devserver-16.1/eds-www/blog/system/database/DB_driver.php
Line Number: 691
May 2016
Su Mo Tu We Th Fr Sa
Date : 6 May 2016
Upload : [Browse]
Title : [Title]
Content : [Content]
[ Submit ]
views/blog.php
PHP Code:
<html>
<title>Blog</title>
<br>
<h1>BLOG</h1>
<?php echo $this->calendar->generate(); ?>
<?php $blogs = $this->blog_model->select_blog(); ?>
<?php foreach ($blogs as $row) : ?>
<i><?php echo $row->date; ?></i><br><br>
<b><?php echo $row->title; ?></b><br><br>
<?php echo $row->content; ?><br><br><br>
<?php endforeach; ?>
</html>
models/blog_model.php
PHP Code:
public function insert_blog()
{
$data = array(
'date' => $this->input->post(date),
'title' => $this->input->post('title'),
'content' => $this->input->post('content')
);
return $this->db->insert('blog', $data);
}
" If I looks more intelligence please increase my reputation."