-
Notifications
You must be signed in to change notification settings - Fork 1
/
display_plot_exp.php
49 lines (43 loc) · 1.58 KB
/
display_plot_exp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Display map of fieldbook
**/
require 'config.php';
require $config['root_dir'] . 'includes/bootstrap.inc';
$mysqli = connecti();
global $config;
require $config['root_dir'] . 'theme/admin_header.php';
if (isset($_GET['uid'])) {
$uid = $_GET['uid'];
} else {
die("Error - no experiment found<br>\n");
}
$sql = "select trial_code from experiments, phenotype_plot_data where experiments.experiment_uid = phenotype_plot_data.experiment_uid and experiments.experiment_uid = $uid";
$res = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
if ($row = mysqli_fetch_assoc($res)) {
$trial_code = $row["trial_code"];
} else {
die("Error - invalid uid $uid<br>\n");
}
$sql = "select phenotype_uid, phenotypes_name from phenotypes";
$res = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
while ($row = mysqli_fetch_assoc($res)) {
$phen_uid = $row["phenotype_uid"];
$name = $row["phenotypes_name"];
$phen_list[$phen_uid] = $name;
}
$count = 0;
$sql = "select fieldbook.plot, phenotype_uid, value from phenotype_plot_data, fieldbook where phenotype_plot_data.plot_uid = fieldbook.plot_uid AND phenotype_plot_data.experiment_uid = $uid";
$res = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
echo "<h2>Phenotype results for $trial_code</h2>\n";
echo "<table>";
echo "<tr><td>count<td>plot<td>trait<td>value";
while ($row = mysqli_fetch_assoc($res)) {
$uid = $row["phenotype_uid"];
$plot = $row["plot"];
$val = $row["value"];
$name = $phen_list[$uid];
echo "<tr><td>$count<td>$plot<td>$name<td>$val\n";
$count++;
}
echo "</table>";