I have developed 2 Database using MySQL and PHP.
I have created member table in which there is a type of user.
On basis of type I restricted user to view private pages.
Now I wanted to check status of users. when they login, logout means timing of the users.

use the php function date, it has many parameters to put, look at www.php.net, its easy

I have knowledge about date function.

I have also know I have to create table in DB in which I have to update at every login and logout for getting my requirement. but I need innovative and easy idea.

alright, I didn't understand from your first post, sorry

I guess a good way is making a table for all the login entries, where you put the id of the user and the time of login, I guess this is the easiet way.

same thing for logout, in a seprate table.

I have a member table...
So u means , I have to create Login and Logout Table in DB which stores login and logout time?

yes, this is the best, as performance and it's neater

in login and logout table which fields necessary for keeping record?

basically only the id of the user and the time of login, that is all you need.

But maybe you want to divide the time to columns, like year,month,day,hour,minute... it's up to you

--
-- Table structure for table `members`
--

CREATE TABLE IF NOT EXISTS `members` (
  `MemId` int(5) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(25) NOT NULL,
  `Password` varchar(20) NOT NULL,
  `Type` varchar(20) NOT NULL,
  PRIMARY KEY (`MemId`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=52 ;

its a table for members, now login and logout table, I only require MemId?

i am still confused

when user sign in how i can record it in log in table

--
-- Table structure for table `login`
--

CREATE TABLE IF NOT EXISTS `login` (
  `MemId` int(5) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(25) NOT NULL,
  `Type` varchar(20) NOT NULL,
  'Time' time  NOT NULL,
  'Date' date NOT NULL,
  PRIMARY KEY (`MemId`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=52 ;

This is my table structure.
Whenever user sign in I check his/her username from members table and on login success I redirect users to private pages on basis of type. Now how I insert record when user sign in.

as I said you need to make a new table.. columns: user_id Login_time...

when the user logs in you add a new entry in this table (the entry will consist of his id and the time of login)... as simple as that!

please reply.
Its not very difficult.

Please share ....

Can I provide my code to u all ???

Thanks. from login success page.

I have to pages when user sign in .
1. checklogin.php
2 loginsuccess
checklogin.php checks the username and password in Db and redirect it to loginsuccess.php after authentication. on which page i have to put query?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.