This repository has been archived by the owner on Nov 18, 2019. It is now read-only.
forked from acossa/botrytis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprot_name_search.php
82 lines (78 loc) · 3.29 KB
/
prot_name_search.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Protein view</title>
<link rel="stylesheet" type="text/css" href="./css/header.css">
<link rel="stylesheet" type="text/css" href="./css/content.css">
<link rel="stylesheet" type="text/css" href="./css/footer.css">
<link rel="stylesheet" type="text/css" href="./DataTables/DataTables-1.10.18/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="DataTables\fixedHeader.dataTables.min.css">
<script type="text/javascript" src="DataTables/jQuery-3.3.1/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./DataTables/DataTables-1.10.18/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="./DataTables\dataTables.fixedHeader.min.js"></script>
</head>
<body>
<div class="heading">
Botrytis Cynerea Database
</div>
<div class="main">
<div class="content">
<?php
$prot = "$_POST[field_prot_name]";
echo "$prot</br>"; // TEST
// Query
try {
$dbh = new PDO('mysql:host=localhost;dbname=botrytis', 'lespinet', '');
$query_prot = $dbh->query('SELECT gene_locus, trans_id, prot_seq, prot_length FROM protein WHERE prot_name = "'.$prot.'";');
} catch (PDOException $e) {
echo "Erreur ! " . $e->getMessage() . "<br/>";
die();
} catch (Exception $ee) {
echo "Erreur ! " . $ee->getMessage() . "<br/>";
die();
}
$colnames = array('Gene Locus', 'Transcript ID', 'Protein Sequence', 'Length');
?>
<script>
$(document).ready(function() {
$('#table_prot').DataTable();
} );
</script>
<table id="table_prot" class="display" style="width:100%">
<thead>
<!-- Colnames -->
<?php foreach ($colnames as $col => $value) {
echo '<th>'.$value.'</th>';
}
?>
</thead>
<tbody>
<?php
try {
while ($row = $query_prot->fetch(PDO::FETCH_ASSOC)) {
// print_r($row);
echo '<tr>';
foreach($row as $key=>$value) {
// echo each value in a table box
// echo $key.'</br>'; // TEST
if ($key == "prot_seq") {
echo '<td style="word-break: break-all" width="33%" >'.$value.'</td>';
} else {
echo '<td style="text-align:center">'.$value.'</td>';
}
}
echo '</tr>';
}
} catch (Exception $e) {
echo "Erreur ! " . $e->getMessage() . "<br/>";
die();
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>