Many days ago discovered the problem, at that time thought is oneself machine problem, now upload cloud server still can't solve, hope big God help me ~
First of all, my personal blog post has a look field in MySQL, each time you view this blog, this field will add 1 to the original value, but the problem is that I always click to see it is the original value plus 2, which really makes me puzzled, see the source
public function viewBlog(){ $_sql='SELECT * FROM blog WHERE id='.$this->_id.' AND verify=1'; $_sqlView='UPDATE blog SET `look`=`look`+1 WHERE id='.$this->_id; parent::aud($_sqlView); return parent::getOne($_sql); }
This is the source code in the model.
private function viewBlog(){ $this->_model->_id=Tool::checkInt(@$_GET['id']); $_oneBlog=$this->_model->viewBlog(); $this->_tpl->assign('oneBlog',$_oneBlog);
This is the controller of the source fragment, has determined that the Viewblog () function is only executed once, and more bizarre is if I click on the comments (comments and views compared to a tag only a #anchor anchor point to the comment box) Its look value will be added 3, and then click on the view or comment it will be normal add 1 ...
Ask the big God to tell the personal blog This is my blog address, not to ask for visits, really ask God ~ ~ ~ ~
Reply content:
Many days ago discovered the problem, at that time thought is oneself machine problem, now upload cloud server still can't solve, hope big God help me ~
First of all, my personal blog post has a look field in MySQL, each time you view this blog, this field will add 1 to the original value, but the problem is that I always click to see it is the original value plus 2, which really makes me puzzled, see the source
public function viewBlog(){ $_sql='SELECT * FROM blog WHERE id='.$this->_id.' AND verify=1'; $_sqlView='UPDATE blog SET `look`=`look`+1 WHERE id='.$this->_id; parent::aud($_sqlView); return parent::getOne($_sql); }
This is the source code in the model.
private function viewBlog(){ $this->_model->_id=Tool::checkInt(@$_GET['id']); $_oneBlog=$this->_model->viewBlog(); $this->_tpl->assign('oneBlog',$_oneBlog);
This is the controller of the source fragment, has determined that the Viewblog () function is only executed once, and more bizarre is if I click on the comments (comments and views compared to a tag only a #anchor anchor point to the comment box) Its look value will be added 3, and then click on the view or comment it will be normal add 1 ...
Ask the big God to tell the personal blog This is my blog address, not to ask for visits, really ask God ~ ~ ~ ~
You don't have to go directly into the database first, test it look
= look
+1 Isn't there a problem here to see if it's really visited once