-
Notifications
You must be signed in to change notification settings - Fork 1
/
queryPathogenGO.php
executable file
·49 lines (30 loc) · 1.13 KB
/
queryPathogenGO.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
// Start the session
ini_set('display_errors', 1);
error_reporting(1);
require("config.php");
$species= $_POST['species'];
$namer= $_POST['namer'];
$outfile = "tmp/".$namer."_OutputQuery.txt";
$link = mysqli_connect('localhost:3306', DB_USER, DB_PASSWORD) or die('Could not connect to mysql');
$link->set_charset("utf8");
mysqli_select_db($link,'trustdb') or die('Could not select database');
$query = 'SELECT * FROM ipscan_go WHERE species="'.$species.'"';
$result = mysqli_query($link,$query) or die('Query failed: ' . mysqli_error($link));
$tabularFile = fopen($outfile, "w") or die("Unable to open file!");
while ($lineQueryResult = mysqli_fetch_array($result, MYSQLI_ASSOC)){
$accession = $lineQueryResult['accession'];
$goTerms = $lineQueryResult['goTerms'];
$interproAcc = $lineQueryResult['interproAcc'];
$interproDesc = $lineQueryResult['interproDesc'];
$line = $accession ."\t". $goTerms ."\t". $interproAcc ."\t". $interproDesc ;
print_r($line);
print_r('\n');
fwrite($tabularFile, $line);
fwrite($tabularFile, PHP_EOL);
}
mysqli_free_result($result);
mysqli_close($link);
fclose($tabularFile);
print_r($namer);
?>