php-第一次点击时,显示的结果是:点击后2,修改后3,执行后3
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
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
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31