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");?> 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})"); 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! 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
Archived
This topic is now archived and is closed to further replies.