I have a game, every 10 minutes the game is updated, now I want to limit the players to the amount of resources they have, which will not pass for some value in SQL
I tried lots of things but nobody does the work
if ($ud == $def_gold) {
$db->query("UPDATE `resources` SET gold=gold=".$gold.", wood=wood=".$wood.", iron=iron=".$iron.", food=food=".$food." WHERE ID='".$ud['wk']['ID']."'");
} else {
$db->query("UPDATE `resources` SET gold=gold+".$gold.", wood=wood+".$wood.", iron=iron+".$iron.", food=food+".$food." WHERE ID='".$ud['wk']['ID']."'");
$db->query("UPDATE `civ` SET untrained=untrained+".$untrained." WHERE ID='".$ud['wk']['ID']."'");
}
This value: $ def_gold
Should be limited in SQL to a certain amount (already limited)
This value: $ ud
Indicates resources
I need to limit players by $ def_gold