Welcome Guest, Not a member yet? Register   Sign In
Saving an Array to Database
#10

[eluser]skunkbad[/eluser]
[quote author="RMinor" date="1349546243"]After reading the replies, I think I misstated my question. I don't want to store the entire array in the database, I want to break the array apart and insert the values into their own fields in my database.[/quote]

If your array is an associative array, and the keys are the names of the fields in the database, you'd do something like this

Code:
$insert_arr = array(
  'name'     => 'Brian',
  'username' => 'skunkbad'
);

$this->db->insert('table_name', $insert_arr);


Messages In This Thread
Saving an Array to Database - by El Forum - 10-05-2012, 10:48 PM
Saving an Array to Database - by El Forum - 10-05-2012, 10:55 PM
Saving an Array to Database - by El Forum - 10-05-2012, 11:11 PM
Saving an Array to Database - by El Forum - 10-05-2012, 11:51 PM
Saving an Array to Database - by El Forum - 10-06-2012, 12:29 AM
Saving an Array to Database - by El Forum - 10-06-2012, 12:46 AM
Saving an Array to Database - by El Forum - 10-06-2012, 01:16 AM
Saving an Array to Database - by El Forum - 10-06-2012, 02:44 AM
Saving an Array to Database - by El Forum - 10-06-2012, 10:57 AM
Saving an Array to Database - by El Forum - 10-06-2012, 11:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB