-
Notifications
You must be signed in to change notification settings - Fork 1
/
db_connect.php
56 lines (51 loc) · 1.19 KB
/
db_connect.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
<?php
$host = 'localhost';
$usr = 'leb4d';
$passwd = '08b995e85136';
$db = 'leb4d';
if (!($conn = @mysqli_connect($host, $usr, $passwd)))
{
die('Connection denied!</br>' . mysqli_error());
}
mysqli_select_db($conn, $db) || die ('Cannot select database: '. $db . mysqli_error());
mysqli_query($conn, 'set character set utf8');
// echo 'Done.';
$table = 'mads';
//$retval = mysqli_query($conn, 'select * from mads');
//if ( ! $retval ) {
// die ( 'Cannot get data: ' . mysqli_error() );
//}
// echo '<h3>Getting data from table mads ...<h3/>';
/*
echo '<table border="2">
<tr>
<td>ID</td>
<td>protein_name</td>
<td>organism</td>
<td>taxon_ID</td>
<td>lineage</td>
<td>protein_length</td>
<td>protein_mass</td>
<td>sequence</td>
<td>description</td>
<td>GO</td>
</tr>';
while ( $row = mysqli_fetch_array($retval, MYSQLI_ASSOC) )
{
echo "<tr>
<td>{$row['ID']}</td>
<td>{$row['protein_name']}</td>
<td>{$row['organism']}</td>
<td>{$row['taxon_ID']}</td>
<td>{$row['lineage']}</td>
<td>{$row['protein_length']}</td>
<td>{$row['protein_mass']}</td>
<td>{$row['sequence']}</td>
<td>{$row['description']}</td>
<td>{$row['GO']}</td>
</tr>";
}
echo '</table>';
mysqli_close($conn);
*/
?>