I have the following problem / question:
I have Wordpress
installed and CodeIgniter
also. In CodeIgniter I have to do a function that adds +1 in the database when a category is seen in wordpress
. Then the following code inside a controller
of codeigniter
<?php
function add($id){
$this->db->where('id', $id);
$banner = $this->db->get('banners')->row();
$add = $banner->views + 1;
$this->db->where('id', $id);
$this->db->update('banners', array('views'=>$add));
return true;
?>
I need to run this code every time someone goes into a category of wordpress
. I thought about doing file_get_contents()
but I do not know if it will work because it takes the contents of a link. I wanted to know how I can do it. The file of wordpress
related to categories I already know, the problem is only in making / using a function to execute when entering or updating the page, because I want to make a banner display system.