I’ve created a login page and in the db table i have a field called last_access to store last login date and time the data type is timestamp
The following is the select statement;
$sql="SELECT * FROM $tbl_name WHERE $db_usercol='$myusername' and $db_passcol='$mypassword'";
$result=mysql_query($sql);
How can i update the field “last_access” every time the user logs in? and set the value to NOW().
Thanks
or you could use
instead of your select, and check how many rows were affected. If none ->login unsuccessfull. if 1 -> login successfull. If more, you got a problem…
But first thing should be removing that SQL injection vulnerability!
Check http://php.net/manual/en/book.pdo.php , some changes would be needed in your SQL functions but it is actually pretty easy to use, example:
It is easy and SQL injection attacks will be unsuccesfull