Jump to content

Recommended Posts

I am very new to php/mysql.

 

I created a login form with username and password. When the user logs in the user name and datetime are successfully stored in a login table. However, it will only capture the information once. The user can successfully "login" more than once, but the information is only gathered once.  I don't know how to make the table consider each login as an individual session. The code I am using is below:

 

$sql="INSERT IGNORE INTO logintimes(user_name,datetime)VALUES('$_POST[fuser_name]', now())";

  $result=mysqli_query($cxn,$sql) or die(mysqli_error($cxn));

       

$_SESSION['auth']="yes";                       

        $_SESSION['logname'] = $_POST['fuser_name'];

include("storedlog.inc");

 

I would appreciate it if anyone can tell me what is missing!

 

Also, I would like to include an auto_incremented cust id field from the registration table that ties to the user name in the registration table to be input in the login table upon login. The cust id field exists in both the login and registration tables as the primary key, but I'm not sure of the code to use to connect them.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.