I found a problem many days ago. I thought it was my machine problem. I still cannot solve the problem after I uploaded my ECS instance. hope you can help me ~ First, my blog post has a Look Field in Mysql. each time I view this blog, this field is added to the original value by 1, but the problem is that I always add 2 to the original value every time I click to view it. this is really confusing. check the source code publicfunctionviewBlog () {$ _ SQL & #39; SELECT * FROMblogWHEREid & #39 ;. $ this-& gt; _ id. & #39; ANDverify1 & #39; $ _ sqlView & #39 mysqlphp blog
I found a problem many days ago. I thought it was my machine problem. I still cannot solve the problem after I uploaded my ECS instance. hope you can help me ~
First, my blog post has a Look Field in Mysql. each time I view this blog, this field is added to the original value by 1, but the problem is that I always add 2 to the original value every time I click to view it. this is really confusing to me. check the source code.
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 source code snippet of the controller. it has been confirmed that the viewBlog () function is only executed once, what's more strange is that if I click a comment (the comment and view are only one more # anchor is located in the comment box), its look value will be increased by 3, then, click View or comment on it to add 1 to it ......
Please tell your blog that this is my blog address, not the access traffic ~~~