![]() |
Blog Input Form - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Blog Input Form (/showthread.php?tid=65147) |
Blog Input Form - davy_yg - 05-05-2016 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> models/blog_model.php PHP Code: public function insert_blog() RE: Blog Input Form - ChicagoPhil - 05-06-2016 (05-05-2016, 10:00 PM)davy_yg Wrote: Hello, Are you using datetime in your table? Lets get that straight first. RE: Blog Input Form - keulu - 05-06-2016 date is not recognized. use PHP Code: date('Y-m-d H:i:s') RE: Blog Input Form - cartalot - 05-06-2016 fix this line in your model: 'date' => $this->input->post(date), RE: Blog Input Form - Wouter60 - 05-06-2016 You probably want to insert the current date/time. This is how to do that: PHP Code: $data = array( If the date is actually posted by your form, in a field named 'date', then the value is in $this->input->post('date'); |