Lithium Posted February 27, 2009 Share Posted February 27, 2009 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! Quote Link to comment Share on other sites More sharing options...
John99 Posted February 27, 2009 Share Posted February 27, 2009 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.. Quote Link to comment Share on other sites More sharing options...
Lithium Posted February 27, 2009 Author Share Posted February 27, 2009 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() Quote Link to comment Share on other sites More sharing options...
John99 Posted February 27, 2009 Share Posted February 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
POG1 Posted February 27, 2009 Share Posted February 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
Lithium Posted February 27, 2009 Author Share Posted February 27, 2009 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 Quote Link to comment Share on other sites More sharing options...
Halo Posted February 28, 2009 Share Posted February 28, 2009 Re: what can it be? Is the table int(11) or bigint(92) if it is then decimals wont work. Quote Link to comment Share on other sites More sharing options...
Lithium Posted February 28, 2009 Author Share Posted February 28, 2009 Re: what can it be? Is the table int(11) or bigint(92) if it is then decimals wont work. hmmm good point! they are INT indeed :| 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.