-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.php
More file actions
executable file
·50 lines (49 loc) · 1.37 KB
/
Copy pathquery.php
File metadata and controls
executable file
·50 lines (49 loc) · 1.37 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
<html>
<body>
<?php
require_once 'login.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());
if(isset($_POST['cat']) &&
isset($_POST['arc']) &&
isset($_POST['top']))
{
$cat = get_post('cat');
$arc = get_post('arc');
$top = get_post('top');
$query = "select * from cathv2 where cat='$cat' and arch='$arc' and topol='$top'";
$result = mysql_query($query);
if(!result) die("unable to process query: " . mysql_error());
$rows = mysql_num_rows($result);
for($j = 0 ; $j < $rows ; ++$j)
{
$row = mysql_fetch_row($result);
echo <<<_EOP1
<pre>
Category id $row[1];
Arch id $row[2];
Topol id $row[3];
Homol fam id $row[4];
Name $row[6];
</pre>
_EOP1;
}
}
echo <<<_EOP
<form action="query.php" method="post"><pre>
Category ID <input type="text" name="cat"/>
Arch ID <input type="text" name="arc"/>
Topol ID <input type="text" name="top"/>
<input type="submit" value="list" />
</pre></form>
_EOP;
mysql_close($db_server);
function get_post($var)
{
return mysql_real_escape_string($_POST[$var]);
}
?>
</pre>
</body>
</html>