Run 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)
Write the following HTML file content:
<HTML>
<Body>
<? PHP
$ Myvar = "visitors :";
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>