• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exclude insertion in the database.....($this->db->insert($table, $_POST))

when using $this->db->insert($table, $_POST); it automatically inserts all input forms in the table......my question is, is there a way to exclude an input type? lets say i have a hidden type, that i only need for my controller, and not necessarily needed in the db

....this is my first post and fairly new to CI, looking forward for the replies

$this->db->insert($table, $_POST);

which is the easiest way. Of course you can have an array representing all fields of your table and then clean the $_POST with

$cleaned_post = array_intersect($table_fields, $_POST);

assuming you have same names for both the table-fields as well as the input-fields.
Refer to http://php.net/manual/en/function.array-...ct-key.php for more info.

thanks for the reply... i think ill try that unset method creating the array would take too long as the table is pretty big

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.