...Cont (4 of 4)
And here's the code that picked up which square was chosen and thus which info to then use:
<?php
// Get required variables for queries
$var_value = $SESSION['myusername'];
$check = $SESSION['employee'];
$fr = $POST['fr'];
$fr2 = $POST['fr2'];
$usename2 = $SESSION['usename2'];
$cund = $POST['cund'];
// In order to know which square of the confusion matrix was chosen, and thus what annotations to base the queries on, create the POST form data
// from the confsuin matrix as an array
$chosen_query = array_pop(array_keys($_POST['Submitano']));
// If squares 1-25 were chosen
if ($chosen_query == 0)
{
$hypoc1 = "a";
$hypoc2 = "a";
}
elseif ($chosen_query == 1)
{
$hypoc1 = "b";
$hypoc2 = "a";
}
elseif ($chosen_query == 2)
{
$hypoc1 = "c";
$hypoc2 = "a";
}
elseif ($chosen_query == 3)
{
$hypoc1 = "d";
$hypoc2 = "a";
}
elseif ($chosen_query == 4)
{
$hypoc1 = "e";
$hypoc2 = "a";
}
elseif ($chosen_query == 5)
{
$hypoc1 = "a";
$hypoc2 = "b";
}
elseif ($chosen_query == 6)
{
$hypoc1 = "b";
$hypoc2 = "b";
}
elseif ($chosen_query == 7)
{
$hypoc1 = "c";
$hypoc2 = "b";
}
elseif ($chosen_query == 8)
{
$hypoc1 = "d";
$hypoc2 = "b";
}
elseif ($chosen_query == 9)
{
$hypoc1 = "e";
$hypoc2 = "b";
}
elseif ($chosen_query == 10)
{
$hypoc1 = "a";
$hypoc2 = "c";
}
elseif ($chosen_query == 11)
{
$hypoc1 = "b";
$hypoc2 = "c";
}
elseif ($chosen_query == 12)
{
$hypoc1 = "c";
$hypoc2 = "c";
}
elseif ($chosen_query == 13)
{
$hypoc1 = "d";
$hypoc2 = "c";
}
elseif ($chosen_query == 14)
{
$hypoc1 = "e";
$hypoc2 = "c";
}
elseif ($chosen_query == 15)
{
$hypoc1 = "a";
$hypoc2 = "d";
}
elseif ($chosen_query == 16)
{
$hypoc1 = "b";
$hypoc2 = "d";
}
elseif ($chosen_query == 17)
{
$hypoc1 = "c";
$hypoc2 = "d";
}
elseif ($chosen_query == 18)
{
$hypoc1 = "d";
$hypoc2 = "d";
}
elseif ($chosen_query == 19)
{
$hypoc1 = "e";
$hypoc2 = "d";
}
elseif ($chosen_query == 20)
{
$hypoc1 = "a";
$hypoc2 = "e";
}
elseif ($chosen_query == 21)
{
$hypoc1 = "b";
$hypoc2 = "e";
}
elseif ($chosen_query == 22)
{
$hypoc1 = "c";
$hypoc2 = "e";
}
elseif ($chosen_query == 23)
{
$hypoc1 = "d";
$hypoc2 = "e";
}
elseif ($chosen_query == 24)
{
$hypoc1 = "e";
$hypoc2 = "e";
}
// If rows (buttons) 25-30 were chosen
elseif ($chosen_query == 25)
{
$hypoc1 = "a' or a1.Hypothesis = 'b' or a1.Hypothesis = 'c' or a1.Hypothesis = 'd' or a1.Hypothesis = 'e";
$hypoc2 = "a";
}
elseif ($chosen_query == 26)
{
$hypoc1 = "a' or a1.Hypothesis = 'b' or a1.Hypothesis = 'c' or a1.Hypothesis = 'd' or a1.Hypothesis = 'e";
$hypoc2 = "b";
}
elseif ($chosen_query == 27)
{
$hypoc1 = "a' or a1.Hypothesis = 'b' or a1.Hypothesis = 'c' or a1.Hypothesis = 'd' or a1.Hypothesis = 'e";
$hypoc2 = "c";
}
elseif ($chosen_query == 28)
{
$hypoc1 = "a' or a1.Hypothesis = 'b' or a1.Hypothesis = 'c' or a1.Hypothesis = 'd' or a1.Hypothesis = 'e";
$hypoc2 = "d";
}
elseif ($chosen_query == 29)
{
$hypoc1 = "a' or a1.Hypothesis = 'b' or a1.Hypothesis = 'c' or a1.Hypothesis = 'd' or a1.Hypothesis = 'e";
$hypoc2 = "e";
}
// If columns (buttons) 31-35 were chosen
elseif ($chosen_query == 30)
{
$hypoc1 = "a";
$hypoc2 = "a' or a2.Hypothesis = 'b' or a2.Hypothesis = 'c' or a2.Hypothesis = 'd' or a2.Hypothesis = 'e";
}
elseif ($chosen_query == 31)
{
$hypoc1 = "b";
$hypoc2 = "a' or a2.Hypothesis = 'b' or a2.Hypothesis = 'c' or a2.Hypothesis = 'd' or a2.Hypothesis = 'e";
}
elseif ($chosen_query == 32)
{
$hypoc1 = "c";
$hypoc2 = "a' or a2.Hypothesis = 'b' or a2.Hypothesis = 'c' or a2.Hypothesis = 'd' or a2.Hypothesis = 'e";
}
elseif ($chosen_query == 33)
{
$hypoc1 = "d";
$hypoc2 = "a' or a2.Hypothesis = 'b' or a2.Hypothesis = 'c' or a2.Hypothesis = 'd' or a2.Hypothesis = 'e";
}
elseif ($chosen_query == 34)
{
$hypoc1 = "e";
$hypoc2 = "a' or a2.Hypothesis = 'b' or a2.Hypothesis = 'c' or a2.Hypothesis = 'd' or a2.Hypothesis = 'e";
}
// Create queries to display annotions and readings for chosen confusion matrix square
// If squares (main buttons and rows) 1-30 were chosen
if (($chosen_query == 0) || ($chosen_query == 1) || ($chosen_query == 2) || ($chosen_query == 3) || ($chosen_query == 4) || ($chosen_query == 5) ||
($chosen_query == 6) || ($chosen_query == 7) || ($chosen_query == 8) || ($chosen_query == 9) || ($chosen_query == 10) || ($chosen_query == 11) ||
($chosen_query == 12) || ($chosen_query == 13) || ($chosen_query == 14) || ($chosen_query == 15) || ($chosen_query == 16) || ($chosen_query == 17) ||
($chosen_query == 18) || ($chosen_query == 19) || ($chosen_query == 20) || ($chosen_query == 21) || ($chosen_query ==22) || ($chosen_query == 23) ||
($chosen_query == 24) || ($chosen_query == 25) || ($chosen_query == 26) || ($chosen_query == 27) || ($chosen_query == 28) || ($chosen_query == 29))
{
$query50 = "SELECT a1.`Patient I.D.`, a2.`Hypothesis`, a1.`Hypothesis`, a1.`Day`, a1.`Hour` , r.`Time` , r.`50%Dex/15uInsulin` ,
r.`Adrenaline`, r.`Alfentanil`, r.`Blood_Pump_Speed`, r.`CVP` , r.`Diastolic`, r.`Dobutamine`, r.`FiO2`, r.`Gelofusin`, r.`Hartmanns`,
r.`HR`, r.`Hydrocortisone`, r.`LiDCOCCI`, r.`LiDCOCCO`, r.`LiDCODO2`, r.`LiDCOSV`, r.`MAP`, r.`MgSO4`, r.`Noradrenaline`,
r.`PiCCO_CI`, r.`PiCCO_CO`, r.`PiCCO_EVLWI`, r.`PiCCO_SV`, r.`Potassium`, r.`Potassium_Phosphate`, r.`Propofol`, r.`Sodium_Chloride_0.9%`,
r.`Sodium_Phosphate`, r.`SpO2`, r.`Systolic`, r.`Temp`, r.`Temp_Site`, r.`Urine:_Catheter`, r.`Vasopressin`, r.`Velosulin`
FROM annotations AS a1, annotations AS a2, readings AS r
WHERE a1.`Patient I.D.` = r.`Patient I.D.`
AND a1.`Day` = r.`Day`
AND a1.`Hour` = r.`Hour`
AND (a1.`Patient I.D.` = a2.`Patient I.D.` OR a2.`Patient I.D.` = '0')
AND a1.`Day` = a2.`Day`
AND a1.`Hour` = a2.`Hour`
AND a1.`Updated? (Y/N)` = '1' and a2.`Updated? (Y/N)` = '1'
AND a1.`Clinician/Rule-Set I.D.` = '".$var_value."'
AND a2.`Clinician/Rule-Set I.D.` = '".$usename2."'
AND (a1.`Hypothesis` = '".$hypoc1."')
AND (a2.`Hypothesis` = '".$hypoc2."')
AND (a1.`Patient I.D.` = '".$fr."') AND (a2.`Patient I.D.` = '".$fr2."' OR a2.`Patient I.D.` = '0')";
$result50 = mysql_query($query50);
....etc
}
else
{
($chosen_query == 30) || ($chosen_query == 31) || ($chosen_query == 32) || ($chosen_query == 33) || ($chosen_query == 34);
// If squares (columns) 31-35 were chosen
$query52 = "SELECT a1.`Patient I.D.`, a1.`Hypothesis`, a2.`Hypothesis`, a1.`Day`, a1.`Hour` , r.`Time` , r.`50%Dex/15uInsulin` , r.`Adrenaline`,
r.`Alfentanil`, r.`Blood_Pump_Speed`, r.`CVP` , r.`Diastolic`, r.`Dobutamine`, r.`FiO2`, r.`Gelofusin`, r.`Hartmanns`, r.`HR`, r.`Hydrocortisone`,
r.`LiDCOCCI`, r.`LiDCOCCO`, r.`LiDCODO2`, r.`LiDCOSV`, r.`MAP`, r.`MgSO4`, r.`Noradrenaline`, r.`PiCCO_CI`, r.`PiCCO_CO`, r.`PiCCO_EVLWI`,
r.`PiCCO_SV`, r.`Potassium`, r.`Potassium_Phosphate`, r.`Propofol`, r.`Sodium_Chloride_0.9%`, r.`Sodium_Phosphate`, r.`SpO2`, r.`Systolic`, r.`Temp`,
r.`Temp_Site`, r.`Urine:_Catheter`, r.`Vasopressin`, r.`Velosulin`
FROM annotations AS a1, annotations AS a2, readings AS r
WHERE a1.`Patient I.D.` = r.`Patient I.D.`
AND a1.`Day` = r.`Day`
AND a1.`Hour` = r.`Hour`
AND (a1.`Patient I.D.` = a2.`Patient I.D.` OR a2.`Patient I.D.` = '0')
AND a1.`Day` = a2.`Day`
AND a1.`Hour` = a2.`Hour`
AND a1.`Updated? (Y/N)` = '1' and a2.`Updated? (Y/N)` = '1'
AND a1.`Clinician/Rule-Set I.D.` = '".$var_value."'
AND a2.`Clinician/Rule-Set I.D.` = '".$usename2."'
AND (a1.`Hypothesis` = '".$hypoc1."')
AND (a2.`Hypothesis` = '".$hypoc2."')
AND (a1.`Patient I.D.` = '".$fr."') AND (a2.`Patient I.D.` = '".$fr2."' OR a2.`Patient I.D.` = '0')";
$result52 = mysql_query($query52);
...etc
Hope this helps.
Paul