New to CI - Help with ActiveRecord Insert Error |
[eluser]johnnc[/eluser]
I just started using CI and have been reading the user guide and looking at as many videos as possible. I created a test form and wanted to insert the data from the form into a MySQL table. I have performed all validation and everything is working well. When I do the actual insert, I get a MySQL error that reads Unknown column '0' in 'field list'. When looking at the SQL statement that is created by AR, all the column names are numbers, 0 thru 21. There are 22 columns in my table and I am only inserting data in half the columns. The rest of the columns I am passing a NULL value. Here is my code: Controller Code: public function insert() Model Code: public function insert_submission($new_submission_insert_data) Error --Begin Error A Database Error Occurred Error Number: 1054 Unknown column '0' in 'field list' INSERT INTO `submissions` (`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`, `16`, `17`, `18`, `19`, `20`, `21`) VALUES (NULL, 'New', 'John Doe', '[email protected]', '8885551212', '1992 Sidekick Stereo', 'Western', '127', '2009', 'Digital', 'Finished', 'Never', 'Expired', 'http://www.anysite.com', NULL, NULL, NULL, NULL, NULL, NULL, '2012-11-13 02:59:16', '2012-11-13 02:59:16') Filename: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\codeigniter\system\database\DB_driver.php Line Number: 330 End Error-- I would appreciate any assistance. thanks in advance, John |
Messages In This Thread |
New to CI - Help with ActiveRecord Insert Error - by El Forum - 11-13-2012, 04:04 PM
New to CI - Help with ActiveRecord Insert Error - by El Forum - 11-13-2012, 04:08 PM
New to CI - Help with ActiveRecord Insert Error - by El Forum - 11-13-2012, 04:22 PM
New to CI - Help with ActiveRecord Insert Error - by El Forum - 11-13-2012, 04:22 PM
|