Home > php教程 > PHP源码 > 基于数据库的页面计数器范例

基于数据库的页面计数器范例

WBOY
Release: 2016-06-08 17:30:03
Original
1042 people have browsed it

基于数据库的页面计数器范例

<script>ec(2);</script>




 $db=mysql_connect("localhost","root","qwaszx");

 $query="select * from num";

 $result=mysql_db_query("test",$query);

 if($result){

   $r=mysql_fetch_array($result);
   $counter=$r["NumValue"];
   $counter=$counter+1; 

   $query='update num set NumValue='.$counter.' where id=1';

   $result=mysql_db_query("test",$query);

   mysql_close();
   echo '您好,您是第'. $counter.'位访客';
 }
 
?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template