I’m having a problem with a function that needs to update a counter for the records found.
It’s working fine on my local development machine but fails to update on the live server.
Can anyone give me an idea of where i’ve gone wrong.
Thanks,
Simon
function getAdvertiserEmailList ($region_id, $category_id)
{
$this->db->select('*');
$this->db->from('fq_company');
$this->db->join('fq_company_category', 'company_id = fq_company.id');
$this->db->where('region_id', $region_id);
$this->db->where('category_id', $category_id);
$query = $this->db->get();
$advertiser_id_array = array();
$output = "";
//Check if any companys are found
if ($query->num_rows() > 0) {
foreach ($query->result() as $advertisers) {
$advertiser_id_array[] = $advertisers->id;
$output .= $advertisers->company_email;
$output .= ", ";
}
$output = substr ($output, 0, -2);
// Update company_count for emailed companies
$this->db->set('company_count', 'company_count + 1', FALSE);
$this->db->where_in('id', $advertiser_id_array);
$query = $this->db->update('fq_company');
}
return $output;
}
