dadamssg Posted April 5, 2009 Share Posted April 5, 2009 if i have a int() field in my db...is there a mysql way to update it by adding one? i want to count how many times a user replies on a forum...i know i can query their username and pull out that number then add one to it, then replace the old one with the new one...but is there a mysql function that does this? Link to comment https://forums.phpfreaks.com/topic/152697-update1/ Share on other sites More sharing options...
Maq Posted April 5, 2009 Share Posted April 5, 2009 There's not need for a function to do this. Just update the column by adding 1 to it. Link to comment https://forums.phpfreaks.com/topic/152697-update1/#findComment-801883 Share on other sites More sharing options...
dadamssg Posted April 5, 2009 Author Share Posted April 5, 2009 how would i do that?...is what im asking Link to comment https://forums.phpfreaks.com/topic/152697-update1/#findComment-801884 Share on other sites More sharing options...
corbin Posted April 6, 2009 Share Posted April 6, 2009 UPDATE table1 SET column1 = column1+1; Link to comment https://forums.phpfreaks.com/topic/152697-update1/#findComment-801901 Share on other sites More sharing options...
aschk Posted April 6, 2009 Share Posted April 6, 2009 p.s. make sure to add a WHERE clause because Corbin's SQL statement will update EVERY row in your table... WHOOPS! Link to comment https://forums.phpfreaks.com/topic/152697-update1/#findComment-802158 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.