Hallo,
versuche gerade einen simpel errechneten Wert in die Datenbank zu schreiben, allerdings erhöht sich dieser bei jedem Aufruf um +1. Wisst Ihr warum?
Wie erwähnt wird bei jedem Aufruf der minimum und maximum Schaden um +1 erhöht. Angefangen von 1 - 2 bin ich nach ein paar Reloads der Seite bei 19-20 ...
Falsche Rechung für PHP?
Allgemein falsche Rechnung?
Habe eine ähnliche Rechnung für das maximale Leben der Spielfigur, das funktioniert einwandfrei:
versuche gerade einen simpel errechneten Wert in die Datenbank zu schreiben, allerdings erhöht sich dieser bei jedem Aufruf um +1. Wisst Ihr warum?
PHP-Code:
// character_attributes = SELECT attributID from $blamiau_usw
// attributID 21 = Stärke
// attributID 31 = minimum Schaden
// attributID 32 = maximum Schaden
$min_damage = character_attributes(31) + character_attributes(21) / 3.66;
mysqli_query($db,
"UPDATE
character_attributes
SET
attributAmount = $min_damage
WHERE
characterID = $characterID
AND
attributID = 31"
);
$max_damage = character_attributes(32) + character_attributes(21) / 2.33;
mysqli_query($db,
"UPDATE
character_attributes
SET
attributAmount = $max_damage
WHERE
characterID = $characterID
AND
attributID = 32"
);
Falsche Rechung für PHP?
Allgemein falsche Rechnung?
Habe eine ähnliche Rechnung für das maximale Leben der Spielfigur, das funktioniert einwandfrei:
PHP-Code:
// hat nichts mit dem Problem-Code zu tun, funktioniert aber :D
$max_health = character_attributes(24) * (3.33 * (characters('levelID') + 1));
mysqli_query($db,
"UPDATE
character_attributes
SET
attributAmount = $max_health
WHERE
characterID = $characterID
AND
attributID = 2"
);
if(character_attributes(1) > $max_health) {
mysqli_query($db,
"UPDATE
character_attributes
SET
attributAmount = $max_health
WHERE
characterID = $characterID
AND
attributID = 1"
);
}

Kommentar