0

There is a stackoverflow question that solves my sql query, but I cant seem to do this is CodeIgnighter.

so far I came up with

$this->db->select('shop_coupons_assoc.*');
$this->db->select('shop_products.*');
$this->db->where('shop_products.id IS NULL');
$this->db->join('shop_coupons_assoc', 'shop_coupons_assoc.product_id = shop_products.id', 'left');

article on SO that seems to be the SQL im trying to do

update My Question: How would I write the SQL in Codeignighter(active record format)

-the above code does not seem to execute

Examples of what i need. Just cant find the documentation for codeignighter

SQL - find records from one table which don't exist in another

How to select all records from one table that do not exist in another table?

Community
  • 1
  • 1
IEnumerable
  • 3,610
  • 14
  • 49
  • 78

1 Answers1

0

Put this below your script and use var_dump to test it:

$result = $this->db->get()->result();
var_dump(result);

EDIT: I see the error now:

$this->db->where('shop_products.id IS NULL');

Should be

$this->db->where('shop_products.id IS', NULL);

You probably overlooked the comma and accolade after the fieldname in the documentation. Also the blank page is probably because your servers php.ini has error_reporting turned of or because you are working in a production environment.

Chris Visser
  • 1,607
  • 12
  • 24