-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProperty_result.php
More file actions
181 lines (166 loc) · 4.69 KB
/
Copy pathProperty_result.php
File metadata and controls
181 lines (166 loc) · 4.69 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
session_start();
?>
<?php
include "navigation.html";
require_once 'login.php';
require_once 'redir.php';
?>
<div id="write" class="container">
<h2>Property search result</h2><hr>
<?php
$db_server = mysql_connect($db_hostname,$db_username,$db_password);
if(!$db_server) die("Unable to connect to database: " . mysql_error());
mysql_select_db($db_database,$db_server) or die ("Unable to select database: " . mysql_error());
$query = "select * from Manufacturers";
$result = mysql_query($query);
if(!$result) die("unable to process query: " . mysql_error());
$rows = mysql_num_rows($result);
$manarray = array();
for($j = 0 ; $j < $rows ; ++$j)
{
$row = mysql_fetch_row($result);
$manarray[$j] = $row[1];
}
if (($_POST['tgval'] != "") && ($_POST['cval']!="")) {
$mychoice=get_post('tgval');
$myvalue=get_post('cval');
$compsel = "select * from Compounds where ";
if($mychoice == "mw") {
$compsel = $compsel."( mw > ".($myvalue - 1.0)." and mw < ".($myvalue + 1.0).")";
}
if($mychoice == "TPSA") {
$compsel = $compsel."( TPSA > ".($myvalue - 0.1)." and TPSA < ".($myvalue + 0.1).")";
}
if($mychoice == "XLogP") {
$compsel = $compsel."( XLogP > ".($myvalue - 0.1)." and XLogP < ".($myvalue + 0.1).")";
}
// echo $compsel;
echo "\n";
$result = mysql_query($compsel);
if(!$result) die("unable to process query: " . mysql_error());
$rows = mysql_num_rows($result);
if($rows > 1000) {
echo "<p>It has <b>", $rows, "</b> results. The fist 1000 compounds are displayed.</p>";
echo '<p>Return to<a class="contentInd" href="Property_select.php">Property Search page.</a>[Click]</p>';
echo<<<TABLE_
<table id='myTable' align="center">
<thead>
<tr>
<th>CID</th>
<th>catName</th>
<th>Manu</th>
<th>nAtm</th>
<th>nCar</th>
<th>nNit</th>
<th>nOxy</th>
<th>nSul</th>
<th>nCycl</th>
<th>nHDon</th>
<th>nHAcc</th>
<th>nRotBon</th>
<th>MW</th>
<th>TPSA</th>
<th>XLogP</th>
<th>Display</th>
</tr>
</thead>
<tbody>
TABLE_;
for($j = 0 ; $j < 1000 ; ++$j)
{
echo "<tr>";
$row = mysql_fetch_row($result);
echo '<td>' . $row[ 0 ] . '</td>';
echo '<td>' . $row[ 11 ] . '</td>';
echo '<td>' . $manarray[$row[10] - 1] . '</td>';
echo '<td>' . $row[ 1 ] . '</td>';
echo '<td>' . $row[ 2 ] . '</td>';
echo '<td>' . $row[ 3 ] . '</td>';
echo '<td>' . $row[ 4 ] . '</td>';
echo '<td>' . $row[ 5 ] . '</td>';
echo '<td>' . $row[ 6 ] . '</td>';
echo '<td>' . $row[ 7 ] . '</td>';
echo '<td>' . $row[ 8 ] . '</td>';
echo '<td>' . $row[ 9 ] . '</td>';
echo '<td>' . $row[ 12 ] . '</td>';
echo '<td>' . $row[ 13 ] . '</td>';
echo '<td>' . $row[ 14 ] . '</td>';
echo '<td><a style="color:blue" href="http://mscidwd.bch.ed.ac.uk/s1986520/test_1/dispaly.php?cid=' . $row[ 0 ] . '">Link</a></td>';
echo '</tr>';
}
echo "</tbody>";
echo "</table>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
} else {
echo "<p>It has <b>", $rows, "</b> results.</p>";
echo '<p>Return to<a class="contentInd" href="Property_select.php">Property Search page.</a>[Click]</p>';
echo<<<TABLESET_
<table id='myTable' align="center">
<thead>
<tr>
<th>CID</th>
<th>catName</th>
<th>Manu</th>
<th>nAtm</th>
<th>nCar</th>
<th>nNit</th>
<th>nOxy</th>
<th>nSul</th>
<th>nCycl</th>
<th>nHDon</th>
<th>nHAcc</th>
<th>nRotBon</th>
<th>MW</th>
<th>TPSA</th>
<th>XLogP</th>
<th>Display</th>
</tr>
</thead>
<tbody>
TABLESET_;
for($j = 0 ; $j < $rows ; ++$j)
{
echo "<tr>";
$row = mysql_fetch_row($result);
echo '<td>' . $row[ 0 ] . '</td>';
echo '<td>' . $row[ 11 ] . '</td>';
echo '<td>' . $manarray[$row[10] - 1] . '</td>';
echo '<td>' . $row[ 1 ] . '</td>';
echo '<td>' . $row[ 2 ] . '</td>';
echo '<td>' . $row[ 3 ] . '</td>';
echo '<td>' . $row[ 4 ] . '</td>';
echo '<td>' . $row[ 5 ] . '</td>';
echo '<td>' . $row[ 6 ] . '</td>';
echo '<td>' . $row[ 7 ] . '</td>';
echo '<td>' . $row[ 8 ] . '</td>';
echo '<td>' . $row[ 9 ] . '</td>';
echo '<td>' . $row[ 12 ] . '</td>';
echo '<td>' . $row[ 13 ] . '</td>';
echo '<td>' . $row[ 14 ] . '</td>';
echo '<td><a style="color:blue" href="http://mscidwd.bch.ed.ac.uk/s1986520/test_1/dispaly.php?cid=' . $row[ 0 ] . '">Link</a></td>';
echo '</tr>';
}
echo "</tbody>";
echo "</table>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
}
} else {
echo '<p><b>No query is given! </b>Return to<a class="contentInd" href="Property_select.php">Property Search page.</a>[Click]</p>';
}
echo <<<_TAIL1
</body>
</html>
_TAIL1;
function get_post($var)
{
return mysql_real_escape_string($_POST[$var]);
}
?>
</div>