Forum Moderators: coopster
<?php
$drug = $_POST['drug'];
$type = $_POST['type'];
$newtot = ($total * 8) - $total;
$relpasetot = ($total * 12)-$total;
$reservetot = ($total * 18)-$total;
mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("mydb") or die(mysql_error());
$result = mysql_query("SELECT SUM($drug) as total FROM treatment");
$total = mysql_result($result, 0, 'total');
if($type == 'new') {
echo "You need ".$newtot." " ."tab of" .$drug;
}
else {
if($type == 'relapse') {
echo "You need ".$relpasetot." " ."tab of" .$drug;
} else { echo "You need ".$reservetot." " ."tab of" .$drug;
}
}
?>
the ouput of this script is 0 which not correct, any one can help plese?