In CodeIgniter using active record, how do I perform a not equal to in $this->db->where(). For instance:
$this->db->where('emailsToCampaigns.campaignId', $campaignId);
Will do equal to, but I need not equal to.
According to the manual this should work:
Custom key/value method:
You can include an operator in the first parameter in order to control the comparison:
$this->db->where('name !=', $name);
$this->db->where('id <', $id);
Produces: WHERE name != 'Joe' AND id < 45
Search for $this->db->where(); and look at item #2.
$this->db->where('emailsToCampaigns.campaignId !=' , $campaignId);
This should work (which you have tried)
To debug you might place this code just after you execute your query to see what exact SQL it is producing, this might give you clues, you might add that to the question to allow for further help.
$this->db->get(); // your query executing
echo '<pre>'; // to preserve formatting
die($this->db->last_query()); // halt execution and print last ran query.