|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
刚开始因为习惯于ASP格式的写法,总是在这些方面出现问题,自己还总是找不到问题所在,这就提醒了自己,在写代码的时候一定要认真,不能粗心地老是少个“;”或者字母大小写不分,要不然很可能找半天都找不到错误。mysql|进程|计数器|详解 运转MYSQL.EXE
mysql> create database counter;
Query OK, 1 row affected (0.10 sec)
mysql> use counter;
Database changed
mysql> create table tl(id integer(2),count integer(5));
Query OK, 0 rows affected (0.21 sec)
mysql> show columns from tl;
+-------+--------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------+------+-----+---------+-------+
| id | int(2) | YES | | NULL | |
| count | int(5) | YES | | NULL | |
+-------+--------+------+-----+---------+-------+
2 rows in set (0.05 sec)
mysql> select * from tl;
Empty set (0.08 sec)
mysql> insert into tl(id,count) values(1,1);
Query OK, 1 row affected (0.02 sec)
mysql> select * from tl;
+------+-------+
| id | count |
+------+-------+
| 1 | 1 |
+------+-------+
1 row in set (0.03 sec)
上面编写HTML文件内容:
<html>
<body>
<?php
$myvar = "来访人数:";
echo $myvar;
?>
<?php
mysql_connect() or die("there are problems to connect to mysql!");
$query="select * from tl";
$result=mysql_db_query("counter",$query);
if($result){
$r=mysql_fetch_array($result);
$counter=$r["count"];
$counter=$counter+1;
echo $counter;
$query="update tl set count='$counter' where id=1";
$result=mysql_db_query("counter",$query);
mysql_close();
}
?>
</body>
</html>
因为函数实在是太多了,慢慢的你就会知道,知道有这个函数就可以。 |
|