Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Loader
#1

[eluser]Unknown[/eluser]
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
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

$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

I will be very thanks full for any help
#2

[eluser]InsiteFX[/eluser]
You have something wrong in your code, CodeIgniter will not run it three times unless there is an error in your code or your making multiple calls to database.

I would check the users ip address and use the session for storing it then check to see if you have already added them for viewing that page. In other words you only want to add them for the first time they view that page.
#3

[eluser]Unknown[/eluser]
result of log for each request of site sooo long and and run cod more than one time in same second, and
no have error just warning for pconnect will be removed in the future




Theme © iAndrew 2016 - Forum software by © MyBB