-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsearch.php
117 lines (103 loc) · 2.29 KB
/
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
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
<?php
/*
search.php
RadElement -- Search CDEs by name or ID number_format
CEK 2016-05-16
*/
require_once ('./config/open_db.php');
extract ($_REQUEST);
if (isset ($q)) {
$q = mysql_real_escape_string ($q);
if (ctype_digit ($q))
$query = "WHERE id = $q";
else
$query = "WHERE name LIKE '%$q%'";
}
else {
$query = '';
}
$result = mysql_query ("SELECT id, name, definition FROM Element WHERE $query");
if (mysql_num_rows ($result) == 1) {
extract (mysql_fetch_assoc ($result));
header ("Location: /element/RDE$id");
exit;
}
$result = mysql_query (
"SELECT id, name, shortName, definition
FROM Element
$query
ORDER BY name");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Radiology CDEs | RadElement.org</title>
<meta name="description" content="Radiology CDE search results | RadElement.org">
<meta name="author" content="">
<?php require_once('config/header.php'); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="js/bootstrap-twipsy.js"></script>
<script src="js/bootstrap-popover.js"></script>
</head>
<body>
<?php
include_once("config/analyticstracking.php");
echo $topbar;
?>
<div class="container">
<div class="content">
<div class="span14">
<h2><?php echo ($q == '' ? "Complete Listing" : "Search: "$q""); ?></h2>
<br>
<?php
if (mysql_num_rows ($result) == "0") {
echo "<p>No matching data elements.</p>";
}
else {
echo "<ul>";
while ($row = mysql_fetch_array ($result)) {
extract($row);
echo "<li><a href=/element/RDE$id>$name</a>\n";
}
}
?>
</ul>
</div>
</div>
<?php
echo $footer;
?>
</div> <!-- /container -->
<script>
<!--
$(function () {
$("a[rel=twipsy]").twipsy({
live: true,
offset: 10
})
})
$(function () {
$("a[rel=popover]")
.popover({
offset: 0,
placement: 'below',
html: true
})
.click(function(e) {
//e.preventDefault()
})
$("a[rel=popover2]")
.popover({
offset: 0,
placement: 'below',
html: true
})
.click(function(e) {
//e.preventDefault()
})
})
-->
</script>
</body>
</html>