rascle Posted February 28, 2010 Share Posted February 28, 2010 Hi I am using the following code: $id = $game['gamenumb']; mysql_query("UPDATE games SET hits = hits+'1' WHERE gamenumb = $id"); which, when a page is viewed the code will +1 to a row in a MySQL db. However for some reason it is adding 2 instead of 1? Does anyone know why this is? Thanks Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/ Share on other sites More sharing options...
inversesoft123 Posted February 28, 2010 Share Posted February 28, 2010 change it to hits=hits+1 Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/#findComment-1019437 Share on other sites More sharing options...
rascle Posted February 28, 2010 Author Share Posted February 28, 2010 for some reason it is still adding 2 ?? Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/#findComment-1019446 Share on other sites More sharing options...
rascle Posted February 28, 2010 Author Share Posted February 28, 2010 i dont know why it is doing this, i have checked everywhere else to make sure that i am not adding +1 somewhere else Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/#findComment-1019448 Share on other sites More sharing options...
inversesoft123 Posted February 28, 2010 Share Posted February 28, 2010 mysql_query("UPDATE games set hits=hits+1 where gamenumb='$id'"); Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/#findComment-1019449 Share on other sites More sharing options...
rascle Posted February 28, 2010 Author Share Posted February 28, 2010 Thanks! Link to comment https://forums.phpfreaks.com/topic/193675-mysql-help/#findComment-1019450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.