Home > Backend Development > PHP Tutorial > Mysql字段原值加1问题,php+mysql

Mysql字段原值加1问题,php+mysql

WBOY
Release: 2016-06-02 11:29:17
Original
1750 people have browsed it

mysqlphp博客

很多天前就发现的问题,当时以为是自己机器问题,现在上传云服务器还是没能解决,望大神助我~
首先是我的个人博客文章在Mysql里有个Look字段,每次查看这个博客,这个字段便在原值上加1,但问题是我每次点击查看它总是原值加2,这真的令我费解,看源码

<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);    }</code>
Copy after login

这是Model里的源码

<code>private function viewBlog(){            $this->_model->_id=Tool::checkInt(@$_GET['id']);            $_oneBlog=$this->_model->viewBlog();            $this->_tpl->assign('oneBlog',$_oneBlog);</code>
Copy after login

这是控制器的源码片段,已确定viewBlog()函数只执行了一遍,更诡异的是如果我点击评论(评论和查看相比a标签只多了一个#anchor锚点定位到评论框)它的look值便会加3,然后再点击查看或评论它便正常加1了。。。。。。
求大神告知个人博客这是我的博客地址,并不是求访问量,真的求大神解答~~~

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template