I'm Giovanni, and I'm a new programmer on CodeIgniter.

Here I want to ask you about Update clause in CodeIgniter,
my code results is unaffected to database, can you correct my code?

Here's my code on my models : news\_model.php

```
function autoupdates($id){
    $this->db->set('viewed', 'viewed + 1', FALSE);
    $this->db->where('id',$id);
    $this->db->update('news');
} 

```

And on my controllers : news.php

```
$this->news_model->autoupdates($this->uri->segment(4));

```

And the link in my views : news\_view.php

```
<?php echo anchor($data2->kategori.'/detail/'.$data2->id,$data2->title) ?>

```

When I try to fill the value of 'id' with a number, the code works, but when I change it to default by using variable ($id) it return a null value, so I can't update a field.

Can you tell me where' my fault?

Thanks before