thefollower Posted December 7, 2007 Share Posted December 7, 2007 I have a query with a division in it but i don't know if the syntax is wrong.. no errors occur but it doesn't appear to work either: does it look right? mysql_query("UPDATE tablename SET CurrentLife=CurrentLife/2 WHERE UserID='$DefenderID'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/80683-solved-division-in-an-update/ Share on other sites More sharing options...
Psycho Posted December 7, 2007 Share Posted December 7, 2007 but it doesn't appear to work either And, what does it "appear" to do? I woud suggest putting the division within parens: UPDATE tablename SET CurrentLife=(CurrentLife/2) WHERE UserID='$DefenderID' Link to comment https://forums.phpfreaks.com/topic/80683-solved-division-in-an-update/#findComment-409207 Share on other sites More sharing options...
Barand Posted December 7, 2007 Share Posted December 7, 2007 Syntax ok, echo $DefenderID to ensure its value is correct Link to comment https://forums.phpfreaks.com/topic/80683-solved-division-in-an-update/#findComment-409208 Share on other sites More sharing options...
thefollower Posted December 7, 2007 Author Share Posted December 7, 2007 DefenderID echo's correctly. But now i know the sytnax works that means my if statement structure is not correct! Thanks for the help guys! Link to comment https://forums.phpfreaks.com/topic/80683-solved-division-in-an-update/#findComment-409211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.