Codeigniter Loader

Hi every body ,

I have problem in codeigniter ,
I want to create article view counter, I create update query in the model to increment number of visitor +1 …
when I run the code, the codeigniter run the query 3 times :mad:
I run the log file in the config, it show me “Final output sent to browser” run 3 times

what’s happens and what should I do to run the code once

I will be very thanks full for any help

Can you post the controller, model and view codes here.

$this->db->where(‘id’, $c_id);
$this->db->set(‘no_views’, ‘no_views + 1’, FALSE);
$this->db->update(‘tabel’);
this code for increment number of views,
i try put this code in model and controller and view but the problem not increment 1 Codeigniter increment +3 for each view
when i make debug for Codeigniter, i found the Codeigniter run the site three times…
how i can make Codeigniter run the code only one time

Take a look at this thread:

The problem was solved due to a missing favicon.ico in the CSS file,

Try remming large blocks of your view using the following and test each removal to see if the problem is eliminated:



<?php if(false) { /* rem following script fragment */ ?>
  <!doctype html>
  <html>
  <head>
...
...
  </head>
<?php };?>

<body>
...
</body>
</html>


i don`t think related with css the problem from codeignitor is run the code three times but display one time

Did you read the thread that I supplied?

Using .htaccess?
Browser requests for missing asset files will be passed back to your application.

Let me restate wiredesignz: Browser requests for missing asset files will be passed back to your application.

>>> Have you looked for such a thing yet. No need to dive into code before doing this.
View with FireFox, browse source and try opening all the CSS, javascript and any other included files such as images. If the file will not open because it is missing then the browser will return with an error to the .htaccess file again causing the code to run again.

Try renaming your .htaccess file and see if the problem persists.

I would put my money on a missing file :slight_smile:

my htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\\s(.*)/index\\.php [NC]
RewriteRule ^ %1 [R=301,L]

ErrorDocument 403 /404
ErrorDocument 500 /404

and i try with empty htaccess is give me same result

and no warning for any file missing

Is the page online, if not can you upload the page and supply the link.