Super simple php image statistician_PHP tutorial

WBOY
Release: 2016-07-13 17:09:33
Original
948 people have browsed it

Super simple php image statistician. I used to make this kind of statistician using txt files. Now I will implement it directly using the database. Let’s take a look at the data structure first.

CREATE TABLE `count` (
`id` int(10) NOT NULL auto_increment,
`value` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312 AUTO_INCREMENT=98 ;

Now that the data is ready, let’s take a look at how the program is implemented.

//Add a record when browsing the page to increase the visit by 1.
$conn=mysql_connect("localhost","root","root");
//echo mysql_error();
mysql_query("set names gb2312");
mysql_select_db("guest");
$sql="INSERT INTO `count` ( `id` , `value` ) VALUES ('', '32')";
$result=mysql_query($sql);
if ($result) {
echo "Insertion successful.";
}
mysql_close($conn);


//Read the record data count(*)
$conn=mysql_connect("localhost","root","root");
//echo mysql_error();
mysql_query("set names gb2312");
mysql_select_db("guest");
$mysql="select * from `count`";

$result=mysql_query($mysql);
$row=mysql_num_rows($result);
for($i=0;$i {
$a=substr($row,$i,1);
$str.= "";
}
?>

The total number of pages isPersonal browsing

Well, the php code is a bit messy, but the functionality can still be achieved.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629747.htmlTechArticleSuper simple php image statistician. I used to make this statistic using txt files, but now I can do it directly Let’s implement it with a database. Let’s take a look at the data structure first. CREATE TABLE `count` ( `id` int(10) N...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!