Welcome Guest, Not a member yet? Register   Sign In
active record and $_POST error...
#3

[eluser]Michael Wales[/eluser]
Yeah, I definitely would not just dump the $_POST array into that field. Here's what you should (and it will give you some practice working with CI!

1. Create an array named (I usually call it $insert) where each key is the name of a column in your record that corresponds to the value from the posted form.
2. Use Active Record to insert this array.

Here's a code example really quick - I've never watched the blog tutorial so I can't use the same fields but you'll get the idea:

Code:
$insert = array{'title' => $this->input->post('title'),
            'body' => $this->input->post('body'),
            'created_on' => now(),
            'user_id' => $this->session->userdata('id'));
if ($this->db->insert('posts', $insert)) {
  return TRUE;
} else {
  return FALSE;
}


Messages In This Thread
active record and $_POST error... - by El Forum - 09-19-2007, 10:52 AM
active record and $_POST error... - by El Forum - 09-19-2007, 11:28 AM
active record and $_POST error... - by El Forum - 09-19-2007, 02:11 PM
active record and $_POST error... - by El Forum - 09-19-2007, 08:11 PM
active record and $_POST error... - by El Forum - 09-21-2007, 11:28 AM
active record and $_POST error... - by El Forum - 09-21-2007, 11:42 AM
active record and $_POST error... - by El Forum - 01-05-2008, 11:12 PM
active record and $_POST error... - by El Forum - 01-07-2008, 06:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB