PDA

View Full Version : mysql and PHP question - need help


zoliky
07-05-06, 04:04 PM
I have a mysq table called "register" with following columns :


mysql_query('CREATE TABLE register (
user_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(25) NOT NULL,
email VARCHAR(50) NOT NULL,
validate VARCHAR(50) NOT NULL,
date_entered DATETIME NOT NULL)');

I insert the date_entered value with NOW(), because NOW() insert the current date.


mysql_query ("INSERT INTO register (user_id, username, email, validate, date_entered) VALUES (0, '".varCheck($_POST['username'])."', '".varCheck($_POST['email'])."', '".sha1($_POST['username'])."', NOW())") or die (mysql_error());

I want to make a column for last_login. I need to see the date when user last login.

I need to do this with login script ? to enter NOW() in a separate column when user log in ?

Thanks

Rayden
07-05-06, 06:56 PM
why not trying to add a column directly through phpmyadmin in your cpanel.

Then you set the title field: last_login
and set the type of field, etc...

zoliky
07-06-06, 03:03 AM
ok to set a column is not a problem.
What type of field I need?

last_login DATETIME NOT NULL ?

Nico
07-06-06, 05:06 AM
Moved to database.