If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Counting DB Requests

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-19-09, 18:28
ninjacore ninjacore is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Counting DB Requests

I have a mysql database set up for my website so members can register and log in to view members only pages.

I want to be able to see how many times people login and the amount of time they are logged in.
How can I set it up so that everytime the table info is requested(user logs in) it increments a value in a different column.

I really don't know how to even start with keeping track of the time logged in so any suggestions would be appreciated.

Confused and a little frustrated
Andrew
Reply With Quote
  #2 (permalink)  
Old 01-19-09, 19:06
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
how do you validate their credentials when they log in?

do you have a table which contains their userid and password?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-19-09, 19:22
ninjacore ninjacore is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
I set up the validating with dreamweaver, with server behaviors.
When they sign up, it inserts the form info in the table, and to log on, it checks to see if the form data is there or not.

I have a table set up with the userid, first name, last name, and email.

I'm using the first name and email instead of a password.

Thanks for the reply
Reply With Quote
  #4 (permalink)  
Old 01-19-09, 20:22
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
could you do a SHOW CREATE TABLE for the table please?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-19-09, 21:34
ninjacore ninjacore is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Here you go.
I switched to my listmail users table so this is what I'm using currently

SQL result
Host: localhost
Database: rgvf3kb2_arrowmailinglist
Generation Time: Jan 19, 2009 at 08:06 PM
Generated by: phpMyAdmin 2.11.9.1 / MySQL 5.0.67-community
SQL query: show create table lm_users ;
Rows: 1

Table Create Table
lm_users CREATE TABLE `lm_users` (
`id` mediumint(9) unsigned NOT NULL auto_increment,
`uid` varchar(7) NOT NULL,
`fname` tinytext NOT NULL,
`lname` tinytext NOT NULL,
`email` varchar(255) NOT NULL,
`dateadd` date NOT NULL,
`refurl` varchar(75) NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `email` (`email`)
) ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8
Reply With Quote
  #6 (permalink)  
Old 01-19-09, 22:07
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by ninjacore
How can I set it up so that everytime the table info is requested(user logs in) it increments a value in a different column.
you can add the login_counter column to your table like this:

ALTER TABLE lm_users
ADD COLUMN login_counter MEDIUMINT NOT NULL DEFAULT 0

you're on your own to get it updated via dreamweaver, though

by the way, your KEYs on uid and email should probably be UNIQUE KEYs
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 01-19-09, 23:49
ninjacore ninjacore is offline
Registered User
 
Join Date: Jan 2009
Posts: 5
Alright, thanks for the tips. I appreciate it.

I'll get it working eventually I always do
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On