Welcome Guest, Not a member yet? Register   Sign In
CI2: data validation before inserting it in DB
#2

[eluser]pickupman[/eluser]
What if you change:
Code:
$this->load->view('news_inserted', $this->data);
$this->db->insert('news', $_POST);

To
Code:
$this->db->insert('news', $_POST);
$this->load->view('news_inserted', $this->data);

You may find it useful to do a
Code:
foreach($_POST as $key => $value){
  $this->db->set($key, $value);
}
$this->db->insert('news');

As a bonus add this to your controller constructor
Code:
$this->output->enable_profiler(TRUE); // get all the CI goodness


Messages In This Thread
CI2: data validation before inserting it in DB - by El Forum - 07-24-2010, 05:03 PM
CI2: data validation before inserting it in DB - by El Forum - 07-24-2010, 07:10 PM
CI2: data validation before inserting it in DB - by El Forum - 07-25-2010, 01:47 AM
CI2: data validation before inserting it in DB - by El Forum - 07-25-2010, 10:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB