denoteone Posted April 29, 2009 Share Posted April 29, 2009 If I have a table named users and a field named 'logincount' that is a small number as of now it is empty I want to updated this number by adding one every time a user logs in. So do I need to get the value of the field and then use php to add 1 and then update the table with the new number? is this the best way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/156115-solved-adding-1-to-a-field/ Share on other sites More sharing options...
revraz Posted April 29, 2009 Share Posted April 29, 2009 You can use SQL to update it UPDATE users SET logincount = logincount + 1 WHERE userid = $uid Quote Link to comment https://forums.phpfreaks.com/topic/156115-solved-adding-1-to-a-field/#findComment-821794 Share on other sites More sharing options...
denoteone Posted April 29, 2009 Author Share Posted April 29, 2009 That worked perfectly. Didn't think it would be that easy. THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/156115-solved-adding-1-to-a-field/#findComment-821840 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.