We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

insert checkbox array within an array

Development and Programming

petattlebaum's avatar
petattlebaum
60 posts
13 years ago
petattlebaum's avatar petattlebaum

I just added more code to the first line. I hate it when I leave out code! … I know I’m making this more complicated than it needs to be so any help is appreciated. I’m inserting a form (EE 2.3.1) using codeigniter, so that I can run a database check to see if the user has already submitted the form.

The checkbox array field (checkboxVar) is causing errors before the data can insert into the db.

$data = array(
 'first_name1' => $this->EE->input->post('first_name1', TRUE),
 'last_name1' => $this->EE->input->post('last_name1', TRUE),
 'checkboxVar' => $this->EE->input->post('checkboxVar', TRUE),
 'form_name' => 'Form Name',
 'entry_date' => $entryDT,
 'edit_date' => $editDT,
 'status' => 'open'
       );

Unfortunately I’m getting an error: Array to string conversion Filename: mysql/mysql_driver.php Line Number: 555

  Error Number: 1054
  Unknown column 'Array' in 'field list'
  ---the insert code appears here---
  Filename: libraries/Functions.php(680) : eval()'d code
  Line Number: 300

Line 300 is below

$this->EE->db->insert('exp_freeform_entries', $data);

Any chance that my first line of code above just needs a slight adjustment and it will be all set? Thanks!

       
petattlebaum's avatar
petattlebaum
60 posts
13 years ago
petattlebaum's avatar petattlebaum

OK, I’m making progress. I know I need to serialize and then unserialize the data prior to inserting in the database.

Step by step!

I’ll post another update once I’ve got this solved…just in case someone runs into the same situation.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.