May I know how exactly equation in PHP works? All my data can be extracted well, but how can I get two data fromuser which are $method=$_GET['method'];
and $valueinsert=$_GET['valueinsert'];
.
$valueinsert=$_GET['valueinsert'];
$method=$_GET['method'];
error_reporting(E_ALL ^ E_DEPRECATED);
//connect to the server
$connect= mysql_connect("127.0.0.1","root","");
//$conn = new mysqli($servername, $username, $password);
if(!$connect)
{
die('Could not connect: '.mysql_error($connect));
}
//connect to the database
mysql_select_db("fyp",$connect);
$query5 = "SELECT method, SUM(revenue), SUM(cost) FROM `table 1` WHERE method = '$method'";
$result5 = mysql_query($query5) or die(mysql_error());
$sql="SELECT * FROM `table 1` WHERE method='$method'";
$query=mysql_query($sql,$connect);
echo"<table align=center width='80%'>";
echo"<td valign='top' width='20%'> ";
echo "<b><u>$method </u></b>" ;
echo "</br>";
while($row = mysql_fetch_array($result5)){
echo "Total Profit = RM ". round($row['SUM(revenue)']- ($row['SUM(cost)']- '$valueinsert' ) ,2);
echo "<br />";
}
echo"</table>";
?>