Log Stats in PHP
In this example we will log some user stats in a database
and then display the resulting info on a seperate page
. Firstly we need to create our database .
CREATE DATABASE stats;
Now we select this database
USE stats;
And now we create our table called stats.
CREATE TABLE stats (
id int DEFAULT '0' NOT NULL auto_increment,
browser varchar(255) NOT NULL,
ip varchar(15) NOT NULL,
recieved logdate NOT NULL,
PRIMARY KEY (id)
);
Now we shall check that we have created the table properly
by typing the following
DESC stats;
This is what you should see in your MySQL client window
(Windows).

In the next part of this tutorial / script we will show
you how to add data in to the database.
|