So I have a table in mySQL that holds sale records which have customerID, productPrice, and quantity. I need to get the cost from each row, and then compile that into a totalCost. I need to use a while loop (assignment instructions) to do so, and so far I have not had any luck. Here is where I am at now, any help is appreciated
while ($record = mysqli_fetch_array($recordSet, MYSQLI_ASSOC)) {
$cost = $productPrice * $quantity
$totalCost = $totalCost + $cost
};
echo "$totalCost";