rendered paste body<?php
$db = new Mysqli('localhost', 'dbaseuser', 'password');
$db->select_db("ascent");
$query = "SELECT entryid, SUM(percentchance) AS calc
FROM loot_fishing
GROUP BY entryid";
$result = $db->query($query);
$ii=0;
while ($t_row = $result->fetch_assoc()) {
$calcData[$ii]["entryid"] = $t_row["entryid"];
$calcData[$ii]["calc"] = $t_row["calc"];
$ii++;
}
foreach ($calcData AS $key => $value) {
$query = "UPDATE loot_fishing
SET percentchance = percentchance/" . $value['calc'] . "
WHERE entryid = " . $value['entryid'];
$db->query($query);
}
?>