Im encourting a problem with my "add" function on the "subscriptions" model. 1% of the registerations is duplicated(2 or even up to 5 times) for some reason.
this is the code im using:
public function add($service, $phone, $sushi_subscription_id, $answer_id, $affiliate_id, $ip, $query, $invite_type, $invite_msg_id)
{
$this->db->set('service_id', $service->id);
$this->db->set('sushi_service_id', $service->sushi_service_id);
$this->db->set('phone', $phone);
if ($sushi_subscription_id)
{
$this->db->set('sushi_subscription_id', $sushi_subscription_id);
}
$this->db->set('answer_id', $answer_id);
if ($affiliate_id)
{
$this->db->set('affiliate_id', $affiliate_id);
}
$this->db->set('added', 'NOW()', FALSE);
$this->db->set('active', 1);
$this->db->set('ip', $ip);
$this->db->set('query', $query);
if ($invite_type)
{
$this->db->set('invite_type', $invite_type);
}
if ($invite_msg_id)
{
$this->db->set('invite_msg_id', $invite_msg_id);
}
return ($this->db->insert($this->_table_name)) ? $this->db->insert_id() : FALSE;
}
any idea how I could avoid this from happaning? the row is exactly the same. service_id, phone, active, even the added date!
addmethod.