Jump to content

[SOLVED] -1 in Mysql


LostKID

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.