LostKID Posted October 16, 2009 Share Posted October 16, 2009 How do i remove -1 in Mysql via php in a query.. Basically i count how many posts the user has made.. it gets added onto their users information.. so i just comments=comments+1 when im adding to their table but tried using comments=comments-1 and it didnt work.. heres the query im using: $query7 = "UPDATE josh_users SET comments=-1 WHERE email='$vemail'"; $result7 = mysql_query($query7) or die (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/177957-solved-1-in-mysql/ Share on other sites More sharing options...
teynon Posted October 16, 2009 Share Posted October 16, 2009 Your query says comments=-1, not comments = comments -1. I would expect your sql database result is telling you the value is -1 Link to comment https://forums.phpfreaks.com/topic/177957-solved-1-in-mysql/#findComment-938286 Share on other sites More sharing options...
LostKID Posted October 16, 2009 Author Share Posted October 16, 2009 nvm i realised that i didnt call in the $vemail to check where to delete it from.. before i used comment=comment-1 but it didnt work so i tried comments=-1 and i guess thats when i last saved it so i changed it back to comments=comments-1 pulled in the email address for the logged user to $vemail so it knew where to delete it from lmao.. sorry thanks for your help though Link to comment https://forums.phpfreaks.com/topic/177957-solved-1-in-mysql/#findComment-938289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.