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()); Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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.