Das ist schon ein Prachtexemplar
/ maximale differenz berechnen $querymax = "SELECT s.value, s.symbol, u.stocklimit, u.name FROM stocks s INNER JOIN userlimits u ON (u.symbol = s.symbol AND u.userid = $userid) ORDER BY u.name ASC"; $resultmax = $mysqli->query($querymax); $maximum = 0; while($rowmax = $resultmax->fetch_array()) { $diff = number_format(100 - (($rowmax[value] / $rowmax[stocklimit]) * 100), 2, '.', ''); $diffabs = abs($diff); if($diffabs > abs($maximum)) { $maximum = $diff; } echo $maximum;