anton_1 Posted March 27, 2012 Share Posted March 27, 2012 what is the best way to add 1 to the database filed TimesLoggedIn after a user has logged in? Regards Ant Link to comment https://forums.phpfreaks.com/topic/259813-add-1-to-timesloggedin-field-after-use-logs-in/ Share on other sites More sharing options...
dragon_sa Posted March 27, 2012 Share Posted March 27, 2012 Pull the current value out of the database when you check the username and password, if they are successful at logging in, add 1 to it and update that field in the database Link to comment https://forums.phpfreaks.com/topic/259813-add-1-to-timesloggedin-field-after-use-logs-in/#findComment-1331590 Share on other sites More sharing options...
Jessica Posted March 27, 2012 Share Posted March 27, 2012 you don't even need to select that value, you can increment a value by using the column name. After they have successfully logged in, UPDATE `loggedInTimes` = `loggedInTimes`+1 WHERE userID = x Link to comment https://forums.phpfreaks.com/topic/259813-add-1-to-timesloggedin-field-after-use-logs-in/#findComment-1331663 Share on other sites More sharing options...
Drummin Posted March 27, 2012 Share Posted March 27, 2012 you don't even need to select that value, you can increment a value by using the column name. After they have successfully logged in, UPDATE `loggedInTimes` = `loggedInTimes`+1 WHERE userID = x I didn't know you could do that. That's cool. Link to comment https://forums.phpfreaks.com/topic/259813-add-1-to-timesloggedin-field-after-use-logs-in/#findComment-1331673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.