I’m building a login application, and I want to store the date the user registered and the last login date as well as the last login ip.
When creating the table what type should I give each of these three columns?
How would I proceed when I insert a new username and other data?
Should I use PHP to get the register date or should I use mysql’s current date?
For the last login date and ip, what way do I do it?
make
create_dateandlast_login_datebothDATETIME‘s andlast_login_ipaVARCHARThis doesn’t matter unless you are required to not use MySQL specific functions.
When a user logs in, run an update statement that fills
last_login_datewith the current timestamp andlast_login_ipwith the contents of$_SERVER['REMOTE_ADDR'].