I'm working on a project on CodeIgniter, but I got an issue right now, I tried to resolve it, but this got the problem.
Here we are : In my code below, I can't update whatever I wan't on my database, but I can insert whatever in.
I'm supposed to update 'mode' from 'landing news soir' to 'landing Offre Gratuite' on the row depending on customer_id.
EDIT : Yeah sry I should've precised that I tried something like if(1===1) but still can't update data.
elseif($all === "gratuite")
{
$mode1="landing news soir";
$mode2="landing Offre Gratuite";
$this->db->select('mode');
$this->db->where('customer', $customer_id);
$this->db->where('mode', $mode1);
$query= $this->db->get('newsletters_inscriptions');
$update_data = array(
'mode' => $mode2);
if($query->row()){
$this->db->where('customer', $customer_id);
$this->db->update('newsletters_inscriptions', $update_data);
}
else{
$insert_data = array(
'newsletter' => '2',
'customer' => $customer_id,
'liste' => 175,
'mode' => 'landing Offre Gratuite');
$this->db->insert('newsletters_inscriptions', $insert_data);
$newsletter_inscription_id = $this->db->insert_id();
// Mise en base dans la liste des objectifs - Stats logs tracking
$this->stats->enregistrer_objectif(null, $this->inscription_newsletter, $customer_id, $newsletter_inscription_id);
}
}
I tried a lot o' ways to resolve it but still can't make it. Thank you.