Click on a link to the database should be the corresponding number of Access + 1, you can only write a method in the current page with JS to access
To get the parameters of the link to click with the AJAX parameters to the controller, in the controller to get the parameters passed over
Find out if there is a record in the database, if there is a field +1 that can be obtained after this data
<a href= ' <?=url::to ([' AAA ', ' ID ' + 1])?> ' class = ' Count_add ' > click </a>
<script>
$ (funcation () {
$ (document). On (' click ', '. Count_add ', function () {
var id = $ (this). attr (' href ');
Id=id.substr (id.indexof ("=") +1,id.length-1);
$.get (' <?=url::to ([' countadd ')];? > ', {' id ': id}, function () {
});
});
});
</script>
Controller
Public Function Actioncountadd ()
{
$id = Intval ($_get[' id ");
$bucket = Bucket::find ()->andwhere ([' user_id ' = ' = $this->_userid, ' id ' = + $id])->one ();
if ($bucket) {
$bucket->count + = 1;
$bucket->save ();
}
return $this->redirect (' index ');
}
Link how to set click once. Database hits plus 1