-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_bioprojects.php
More file actions
31 lines (26 loc) · 1.12 KB
/
get_bioprojects.php
File metadata and controls
31 lines (26 loc) · 1.12 KB
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
<?php
include('db.php');
$key = urldecode($_GET['key']);
$keyType = urldecode($_GET["keyType"]);
if ($keyType == "ds") {
$query = "select ".implode(",", $viewBioProjectAttributes)." from bioproject where Grp like ?";
$key = "%".$key."%";
} elseif ($keyType == "sg") {
$query = "select ".implode(",", $viewBioProjectAttributes)." from bioproject where BioProject in (select distinct(BioProject) from run where SubGroup = ?);";
} elseif ($keyType == "is") {
$query = "select ".implode(",", $viewBioProjectAttributes)." from bioproject where BioProject in (select distinct(BioProject) from run where IsolationSource = ?);";
}
// echo $query." ".$key;
$conn = connect();
$stmt = $conn->prepare($query);
$stmt->bind_param("s", $key);
// $stmt->execute();
// $result = $stmt->get_result();
// echo $result->num_rows." ".$result->field_count."<br/><br/>";
// $rows = $result->fetch_all(MYSQLI_ASSOC);
$rows = execute_and_fetch_assoc($stmt);
$rowsJSON = json_encode($rows);
$stmt->close();
closeConnection($conn);
echo $rowsJSON;
?>