Jump to content
MakeWebGames

Recommended Posts

Posted

SQL Query

 

UPDATE uBANK SET bMONEY = bMONEY + floor(bMONEY * 0.01) WHERE bMONEY > 0

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE uBANK SET bMONEY = bMONEY + floor(bMONEY * 0.01) WHERE bMONEY > 0' at line 1

And No matter what, the query is fine, yet it keeps popping that error out!

Posted

Re: what can it be?

Hmm i aint sure try

UPDATE `uBANK` SET `bMONEY` = `bMONEY` + floor(`bMONEY` * 0.01) WHERE (`bMONEY` > '0')

Or

UPDATE `uBANK` SET `bMONEY` = `bMONEY` + floor(`bMONEY`, * 0.01) WHERE (`bMONEY` > '0')

Aint sure..

Posted

Re: what can it be?

Crazy-T those will also error... at least up to a certain point!

I just found out that FLOOR() errors if its value is 0 :|

As soon as i placed bMONEY over 100 it went fine. Also if anyone wants to know, the same thing happens with ROUND()

Posted

Re: what can it be?

 

Crazy-T those will also error... at least up to a certain point!

I just found out that FLOOR() errors if its value is 0 :|

As soon as i placed bMONEY over 100 it went fine. Also if anyone wants to know, the same thing happens with ROUND()

Oh okay, thanks for thoses tips :P

Posted

Re: what can it be?

 

"UPDATE uBANK SET bMONEY = bMONEY + ".floor($ir['bMONEY'] * 0.01)." WHERE bMONEY > 0"

 

Use the PHP floor function. Also if you try and round 0 how would you do it? its imposible..

 

 

 

 

Edit: Fixed PHP tags

Posted

Re: what can it be?

@POG1

thx for the heads up, yet using php floor() was not an option that was why i only refered to SQL functions.

And ROUND(value, 0) is possible though it also errored if round value was 0.

i managed to make a work around, not perfect but functional though :)

UPDATE uBANK SET bMONEY = bMONEY + FLOOR( bINTEREST * bMONEY / 100 ) WHERE bMONEY > 100

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