I want to use PHP variables in the formula that came from the database data.
I want to do mathematical logic using a database so users can change the whole logic of output using those variables.
if any clarification is needed you can comment.
thanks in advance :)
<?php
include '../../db.php';
$a = 50;
$b = 20;
$c = 30;
$fq = $conn->query("SELECT * FROM `test`");
$fdata = $fq->fetch_array();
$formula = $fdata['formula'];
echo $output = $formula;
?>
Database table
Current Output
$a+$b-$c
Expected Output
40