Ok, here is another one I found that you can try.
PHP Code:
// Usage:
$data = array(
'item' => $post_array['employee_title'],
'campaign' => $this->session->userdata('campaign'),
'userid' => $this->session->userdata('userid')
);
$this->insertIgnore($data);
Place this into your model:
PHP Code:
// Add this to your model.
/**
* Prepare INSERT IGNORE SQL query
*
* @param Array $data Array in form of "Column" => "Value", ...
* @return Null
*/
protected function insertIgnore(array $data)
{
$_prepared = array();
foreach ($data as $col => $val)
{
$_prepared[$this->db->_escape_identifiers($col)] = $this->db->escape($val);
}
$this->db->query('INSERT IGNORE INTO `titles` ('.implode(',',array_keys($_prepared)).') VALUES('.implode(',',array_values($_prepared)).');');
}
You may need to change it from protected to public if your not calling it from within.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )