Jump to content
MakeWebGames

Recommended Posts

Posted

I want the query to give exactly 10% of energy but this is not right

$db->query("UPDATE users SET energy=energy+10 WHERE userid=$userid");

$db->query("UPDATE users SET energy=maxenergy WHERE energy > maxenergy");

What do i do so it is the percent not the value?

Guest Anonymous
Posted

Re: [v2] Adding exact % energy

One also has to question the point of using two queries...

Ever heard of LEAST()

Posted

Re: [v2] Adding exact % energy

im sure that would not work

$energy = floor($ir[energy] * $ir[maxenergy]/10);

now that's 10 %

let me make it clear what im saying is 10% in-case someone misunderstands me lol

$ir[maxenergy]/10

^^

Posted

Re: [v2] Adding exact % energy

$energy = floor($ir[energy] * 10%);

That would work;

10% is a tenth of a whole so to times it by any number would give a tenth of the number.

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.   Paste as plain text instead

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