netpants Posted February 7, 2007 Share Posted February 7, 2007 OK I am trying to subtract 10% from the value of the uOffensiveMen Table if the value is greater than 10. $db->query("UPDATE users SET uOffensiveMen=uOffensiveMen-(uOffensiveMen*0.10) WHERE uRace=1 AND uOffensiveMen>10"); I start with the value of 20 in my table and it subtracts 2 the first time, but then when I run it again it still subtracts 2, and run again it will only subtract 2 again over and over until the value is below 10. What am I doing wrong? Quote Link to comment Share on other sites More sharing options...
btherl Posted February 7, 2007 Share Posted February 7, 2007 Can you give some more detail? Perhaps the code surrounding the query as well? The definition of the table will be useful too. Quote Link to comment Share on other sites More sharing options...
netpants Posted February 7, 2007 Author Share Posted February 7, 2007 Well all that surrounds the query is more querys, it is setup to run in a cron. What is supposed to happen is that every day once a day the query will run via cron jobs, and subtract 10% from the uOffensiveMen table value . Quote Link to comment Share on other sites More sharing options...
btherl Posted February 7, 2007 Share Posted February 7, 2007 Can you run the query manually to verify that it is in fact subtracting 2 every time? You could try this out: SELECT uOffensiveMen, uOffensiveMen*0.10 AS sub FROM users WHERE uRace=1 AND uOffensiveMen>10 And yes, I am interested in the other queries that surround that query The entire script if possible, as long as it's not hundreds or thousands of lines. 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.