I have a mysql set up and it is full working however there is one thing more I would like to do. Is there a way that when a user enters their username and password and clicks login in it will store their browser and browser version in in a new column in mysql?
Share
I’m assuming the server-side technology is php since you’re mentioning mysql. If that’s incorrect, let me know and I’ll correct the following.
You can use
$_SERVER['HTTP_USER_AGENT']to get their browser (and parse the value to determine the actual agent (e.g. IE, Firefox, Opera, etc.)) then save that information back to the database.Update
First, you need to add a new column to the
usertable to allow for an additional piece of information (the browser):This will need to be performed directly on the database, so however you added the
usertable intially, you’ll need to execute the above code (phpMyAdmin I’m guessing?)Next you need to modify your
UPDATEcall to also include the useragent:And that should be all there is to it.