Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2009
    Posts
    5

    Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    how do you validate their credentials when they log in?

    do you have a table which contains their userid and password?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    could you do a SHOW CREATE TABLE for the table please?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    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

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Jan 2009
    Posts
    5
    Alright, thanks for the tips. I appreciate it.

    I'll get it working eventually I always do

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •