我将此脚本设置为每 5 分钟运行一次的 cron 作业,问题是它不会像我认为的那样增加能量水平。如果有人能告诉我我在这里做错了什么,那就太好了。请记住,这不会返回任何错误,只是不起作用,数据库连接信息也是正确的,只是在帖子之外。
{
$energy = mysql_query("SELECT energy FROM members WHERE id=$id");
//get current users energy level
$energy_max = mysql_query("SELECT energy-Max FROM members WHERE id=$id");
//get current users Maximum energy level
if ($energy < $energy_max)
// do -if current energy level is less than maximum
{
$energy = $energy ++;
//increment energy by 1
mysql_query("UPDATE members SET energy= $energy");
//set the new energy level
}
$id++;
//increment to the next user
}