I was thinking that a cron job would do the trick, but I really don’t know. What I’m trying to do is add interest automatically to a field. The field name is balance, and the table name is users, if that helps at all. It’s 1% interest every day at midnight.
[php]<?php
$host=“localhost”;
$username=“lhoward_lhoward”;
$password=“ne14a69?”;
$db_name=“lhoward_phil”;
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect”);
mysql_select_db("$db_name")or die(“cannot select DB”);
$sql=“SELECT balance FROM users”;
$result=mysql_query($sql);
$amount=balance;
$add=1.01;
$balance= ‘$amount’ * ‘$add’;
while($row = mysql_fetch_array($result))
{
$sqla=“UPDATE users SET balance == ‘$balance’”;
$resulta=mysql_query($sql);
if($resulta) { echo “Success!”; }
else { echo “fail.”; }
}
mysql_close();
?>[/php]