So, Im fetching the last record on the table "energy"
function find_all_energy() {
global $db;
$sql = "SELECT * FROM energy ORDER BY energyID DESC";
$result = mysqli_query($db, $sql);
$energy = mysqli_fetch_assoc($result);
mysqli_free_result($result);
return $energy;
}
The last record returns "1000", but what if there are new inserted record(s) like "2000", I want to return it as "3000" because of ( += ) and new inserted record(s) again like "5000" then it will fetch it as "8000" and so on. Thank you!