views:

153

answers:

3

The value will be used as:

from INTEGER UNSIGNED NOT NULL

which defines different visitors that haven't login.

How to properly generate that number with PHP?

EDIT:

If using database as follows:

create table user_visits(
    id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    primary key(id)
);

How to insert a new record into it?

+1  A: 

Use the id:

INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT
soulmerge
That's from database.How to do that from PHP?
Shore
You posted the database field to insert to, so I thought you want to store them in the database. INSERT and select the inserted id with mysql_insert_id().
soulmerge
OK,I've declined to use database now.But how to insert a new record into it?
Shore
`INSERT INTO user_visits (id) VALUES (NULL);`
soulmerge
A: 

You can insert a value in a database each time with an auto_increment column.

You can also use the php function uniqid().

codymanix
+2  A: 

http://www.php.net/manual/en/function.uniqid.php

Aziz
uniqid() returns a string
soulmerge