![]() |
posted data + field not in table - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: posted data + field not in table (/showthread.php?tid=9687) |
posted data + field not in table - El Forum - 07-04-2008 [eluser]allibubba[/eluser] ok, so a quick layout of what i'm doing. my form: -name -emailConfirm -password -passwordConfirm and my table is of course the same: -id -name -emailConfirm -password -passwordConfirm and when validation is passed i update like so: Code: $this->db->insert('users', $_POST); this works fine, but what i would like to do is not have emailConfirm and passwordConfirm in my table (need them in my form for validation though), it makes editing and updating accounts a pain. i would like my table to just be this: -id -name -password but i get an error: Unknown column 'emailConfirm' in 'field list' i know i could do something like this: Code: $this->db->set('name', $name); but that seems like an inefficient way of doing things, especially since my form and table are actually a lot larger, i gather addresses for billing and shipping and a bunch of other stuff. so i guess i'm wondering how i can filter out formfields from my post data? i know i could set up an ajax call to handle this, but for now i would like to keep all my functionality in CI (still learning the framework) posted data + field not in table - El Forum - 07-04-2008 [eluser]kidego32[/eluser] Hi, check out this link: Model Helpers The function compares the table POST data against the table fields, and removes (unsets) the ones that aren't in the table. Hope it helps. posted data + field not in table - El Forum - 07-05-2008 [eluser]allibubba[/eluser] nice, i'll take a closer look at this later, but it looks like exactly what i was thinking |