[eluser]Unknown[/eluser]
Hello,
I have a content management system built with CoideIgniter. I used it to publish articles.
I count number of readers for each article. Everytime the page of an article is displayed, the article is loaded from mysql database to a view and there's an insert query to log IP address of reader and an article ID as a new row in database.
But when I enable caching it just shows the cached view, but new row insert does not work.
Any ideas how to insert a row before loading a cached view?
Insert code in controller:
Code:
$data = array(
'article_id' => strip_tags($id) ,
'ip' => $this->input->ip_address()
);
$this->db->insert('articles_impressions', $data);
And a cache code (caching for five minutes):
Code:
$this->output->cache(5);