php-第一次点击时,显示的结果是:点击后2,修改后3,执行后3

WBOY
Release: 2016-06-02 11:31:22
Original
990 people have browsed it

php

list.php文件

<code> <td>     <a href="show.php?vid=<?php%20echo%20%24posts%5B'id'%5D;?>">    <?php echo $posts['post_title'] ?>    </a>    </td></code>
Copy after login

show.php文件

<code> //获取传过来文章ID    $id=$_GET['vid'];    //根据文章ID来得到文章对象    $sqlStr_post="select * from dt_posts where id=".$id;    $result=mysql_query($sqlStr_post);    $view=mysql_fetch_array($result);    //点击前    echo "点击后:".$view['view_count'];    $num=$view['view_count']+1;    //没当用户一点击,就会修改查看次数    $sql_up="update dt_posts set view_count=".$num." where id=".$id;    echo "修改后:".$num;    $result_up=mysql_query($sql_up);    echo "执行后".$num;</code>
Copy after login
Related labels:
php
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