public function insertOrUpdate($table, array $set, array $where)
    {
        if ($this->select($table, $where)) {
            $result = $this->update($table, $set, $where);
        } else {
            $params = array_merge($where, $set);
            $result = $this->insert($table, $params);
        }

        return $result;
    }
public function insertOrUpdate($table, array $set, array $where)
    {
        if ($this->select($table, $where)) {
            $result = $this->update($table, $set, $where);
        } else {
            $params = array_merge($where, $set);
            $result = $this->insert($table, $params);
        }

        return $result;
    }
public function insertOrUpdate ( $ table , array $ set , array $ where ) { if ( $ this -> select ( $ table , $ where ) ) { $ result = $ this -> update ( $ table , $ set , $ where ) ; } else { $ params = array_merge ( $ where , $ set ) ; $ result = $ this -> insert ( $ table , $ params ) ; } return $ result ; }
Insert a new record into a table, unless it already exists in which case update it
Insert a new record into a table unless it already exists in which case update it