xcandiottix Posted September 11, 2010 Share Posted September 11, 2010 I have a table that I am using UPDATE when someone creates a post. Is there a way to incrementally increase the table with out loading the value of the field first? Ex: mysql_query("UPDATE table SET Time='$date' AND Replies++ WHERE Topics='$topic'"); The above doesn't work but i'd rather make this work instead of querying the DB for the value, adding one, and then updating. Thanks Link to comment https://forums.phpfreaks.com/topic/213169-update-incrementally/ Share on other sites More sharing options...
BizLab Posted September 11, 2010 Share Posted September 11, 2010 Hey man, long time. You should be able to: $query = "UPDATE table SET Time='$date' AND replies=replies+1 WHERE Topics='$topic'"; let me know how that works out for ya Link to comment https://forums.phpfreaks.com/topic/213169-update-incrementally/#findComment-1109984 Share on other sites More sharing options...
xcandiottix Posted September 11, 2010 Author Share Posted September 11, 2010 Hey man, long time. You should be able to: $query = "UPDATE table SET Time='$date' AND replies=replies+1 WHERE Topics='$topic'"; let me know how that works out for ya I messed you up by accident: $query = "UPDATE table SET Time='$date',replies=replies+1 WHERE Topics='$topic'"; No AND .. but yes this worked perfectly... saves me a big headache. Thanks man! Link to comment https://forums.phpfreaks.com/topic/213169-update-incrementally/#findComment-1109989 Share on other sites More sharing options...
BizLab Posted September 11, 2010 Share Posted September 11, 2010 My bad! I didn't read over the code lol No prob man Link to comment https://forums.phpfreaks.com/topic/213169-update-incrementally/#findComment-1109991 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.