chinclub Posted May 7, 2007 Share Posted May 7, 2007 I am trying to write a PHP script that will be run by cronjobs that will add interest to all of my members money, however, instead of adding the interest it just sets everyone's money at 0. What am I doing wrong? <? include("header.php"); $interest_rate = 2 / 100; $update = mysql_query("UPDATE `members` SET `bank` = 'bank + (bank*{$interest_rate})'"); if($update) { print "<h2>Done!</h2>"; } else { print mysql_error(); } include("footer.php");?> Quote Link to comment https://forums.phpfreaks.com/topic/50354-solved-help-with-update-mysql_query/ Share on other sites More sharing options...
trq Posted May 7, 2007 Share Posted May 7, 2007 Try... mysql_query("UPDATE `members` SET `bank` = bank + (bank*{$interest_rate})"); Quote Link to comment https://forums.phpfreaks.com/topic/50354-solved-help-with-update-mysql_query/#findComment-247240 Share on other sites More sharing options...
chinclub Posted May 7, 2007 Author Share Posted May 7, 2007 That did it! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50354-solved-help-with-update-mysql_query/#findComment-247250 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.