Begin with selecting value from column where the value is not null. note that the value is float.
$sql = "SELECT cf_user, cf_pakar FROM chevy.gejala1 WHERE cf_user != 'null' and cf_pakar != 'null'";
$result = $conn->query($sql);
after that, I put it in array variable then do math operation with it.
if ($result->num_rows > 0 ) {
// output data from each row
while($row = $result->fetch_assoc()) {
$cf_user =$row["cf_user"] ;
$cf_pakar = $row["cf_pakar"];
$gejala = array ($cf_pakar*$cf_user);
}
} else {
echo "0 results";
}
sample :
I have 3 value from $cf_user (0.2, 0.4 and 0.6) and $cf_pakar (1, 1 and 1),
then, $gejala will show 3 results.
$cf_user*$cf_pakar = 0.2, 0.4 and 0.6 when I echo using foreach.
the problem is :
what I have in $gejala is: (0.20.40.6) as result array.
count of $gejala is 1 and the value is float.
How do I separate the result? Because I have another math operation with each result letter on.