PHP mysql database page counter example code_PHP tutorial

WBOY
Release: 2016-07-13 17:04:17
Original
963 people have browsed it

This program is a simple example code of page counter for php mysql database, so that you can query the number of visits to your web page.

This program is a simple example PHP tutorial mysql tutorial database tutorial Page counter example code, so that you can query the number of visits to your web page.


Database-based page counter example

$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 'Hello, you are the '.$counter.' visitor';
}

?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630868.htmlTechArticleThis program is a simple example code of page counter of php mysql database, so that you can query The number of visits to your web page. This program is a simple example...
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