Jump to content

UPDATE query - Help Needed


netpants

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.