Chumper
Erfahrenes Mitglied
PHP:
foreach ($weapons as $id => $weapon)
{
if (($weapon != "") && ($weapon != "0"))
{
$db = connect_db();
$weapons=mysql_fetch_assoc(mysql_query("SELECT * FROM weapons WHERE `id` = '$id'", $db));
$time = time()+$row[duration];
$progress = "$time|$weapons[name]|$weapon";
mysql_query("UPDATE citys SET `weaponprogress` = '$progress' WHERE `coordinates` = '$city'", $db);
mysql_close($db);
}
}
Beispiel dazu:
$weapons[33] = "lol";
dann ist in der foreachschleife
$id = 33
und
$weapon = "lol"