Im having trouble finding a solution to this. My code below is pulling data from MYSQL successfully. Where I have echoed $weight[‘weight’]."
";, this shows the correct data. As this data is a single piece (decimal number) I want to then use that result from the Mysql query as a variable to use in mathematical sums further into my script. How do I get the data that has been pulled into a variable? Have tried simply “$weight” and “$reuslt4”. Any help much appreciated. Am finding tutorials online contradictory.
$sql4 = “SELECT weight FROM led.panels WHERE panelid = 1”;
$result4 = (mysqli_query($link, $sql4));
while ($weight = $result4->fetch_assoc()) {
echo
$weight[‘weight’]."
";
}