Welcome Guest, Not a member yet? Register   Sign In
UPDATE when exists otherwise INSERT (with active Record) Best practice?
#11

[eluser]Peter O'Sullivan[/eluser]
Correct me if I'm wrong xwero, but your code

Code:
// Check if a record exists for this SKU
$this->db->where('sku',$sku);
if ($this->db->count_all_results() == 0) {

Needs to have the a 'from' part.

The code needs to be

Code:
// Check if a record exists for this SKU
$this->db->from('products')->where('sku',$sku);
if ($this->db->count_all_results() == 0) {

Correct?


Messages In This Thread
UPDATE when exists otherwise INSERT (with active Record) Best practice? - by El Forum - 03-08-2009, 05:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB