Welcome Guest, Not a member yet? Register   Sign In
Blog Input Form
#1

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."
Reply


Messages In This Thread
Blog Input Form - by davy_yg - 05-05-2016, 10:00 PM
RE: Blog Input Form - by ChicagoPhil - 05-06-2016, 12:18 AM
RE: Blog Input Form - by keulu - 05-06-2016, 12:55 AM
RE: Blog Input Form - by cartalot - 05-06-2016, 12:10 PM
RE: Blog Input Form - by Wouter60 - 05-06-2016, 01:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB