-
Notifications
You must be signed in to change notification settings - Fork 22
/
search.php
51 lines (45 loc) · 2.04 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
<?php
include 'classes/database.php';
include 'classes/table.php';
include 'classes/variable.php';
include 'include/header.php';
//open DB
include 'include/dbconnopen.php';
$search_results = mysqli_query($cnnCDD, "Call Main_Search('" . $_POST['search_criteria'] . "')");
//close DB
include ('include/dbconnclose.php');
?>
<script>
$(document).ready(function() {
document.getElementsByName('search_criteria')[1].focus();
});
</script>
<h3>Search Results:</h3>
<form action="search.php" method="post">
<input type="text" id="search_criteria" class="main-search span5" name="search_criteria" style="margin: 0px;" value="<?php echo (isset($_POST['search_criteria'])) ? $_POST['search_criteria'] : ''; ?>" />
<input type="submit" class="btn btn-primary" value="Search" />
</form>
<div style="margin-left: 20px;">
<?php
while ($result_element = mysqli_fetch_assoc($search_results)) {
//if element is a database
if ($result_element['Element_Type'] == 'Database') {
$database = Database::get_database_info($result_element['Element_ID']);
?>
<a href="database_info.php?database_id=<?php echo $database['Database_ID']; ?>"><i class="icon-th-large"></i> <?php echo $database['Database_Name']; ?></a> (database)<br />
<?php
} else if ($result_element['Element_Type'] == 'Table') {
$table = Table::get_table_info($result_element['Element_ID']);
?>
<a href="table_info.php?table_id=<?php echo $table['Table_ID']; ?>"><i class="icon-th"></i> <?php echo $table['Table_Name']; ?></a> (table)<br />
<?php
} else if ($result_element['Element_Type'] == 'Variable') {
$variable = Variable::get_variable_info($result_element['Element_ID']);
?>
<a href="variable_info.php?variable_id=<?php echo $variable['Variable_ID']; ?>"><i class="icon-asterisk"></i> <?php echo $variable['Variable_Name']; ?></a> (variable)<br />
<?php
}
}
?>
</div>
<?php include 'include/footer.php'; ?>