-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
89 lines (81 loc) · 2.9 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
<!DOCTYPE html>
<html>
<head>
<style>
.a{
display:none;
}
</style>
</head>
<body>
<form name="input" action="search.php" method="get">
Search: <input type="text" name="query">
<input type="submit" value="Submit">
<input type="range" name="slider1" min="0.0" max="1.0" value="0.50" step="0.01" onchange="showValue(this.value)">
<span id="range">0.50</span>
</form>
<?php
require "server.php";
if(isset($_GET['query'])){
$portNumber = '7051';
$myResults = queryIndex($portNumber, "localhost", $_GET['query'],$_GET['slider1']);
//echo $myResults[0]['id'];
//var_dump($myResults);
$con = mysqli_connect("localhost","group51","test","group51");
for( $i = 0 ; $i<count($myResults) && $i<10 ;$i++)
{
echo "The Url is:<a href='http://en.wikipedia.org/wiki?curid=".$myResults[$i]['id']."'>http://en.wikipedia.org/wiki?curid=".$myResults[$i]['id']."</a>";
echo "<button onclick='hideTR()'>Show Summary</button>"
echo "<div class='a'>";
$query = mysqli_query($con,"select * from imageUrl where id ='".$myResults[$i]['id']."'");
$result=mysqli_fetch_array($query);
echo "<img src='".$result['url']."'>";
echo "categorys:<br>";
$query = mysqli_query($con,"select * from category where eecs485_article_id ='".$myResults[$i]['id']."'");
while($result=mysqli_fetch_array($query))
{
echo $result['eecs485_article_category']."<br>";
}
$query = mysqli_query($con,"select * from info where eecs485_article_id ='".$myResults[$i]['id']."'");
while($result=mysqli_fetch_array($query))
{
echo $result['eecs485_article_summary']."<br>";
}
echo "</div>";
//do it in naive way
//each time Got a docid
// query the database to retrieve the info we need
// the sequence
$query = mysqli_query($con,"select * from imageUrl where id ='".$myResults[$i]['id']."'");
//$result = mysqli_fetch_array($query);
//echo "<tr>";
//echo "<td>".$result["sequencenum"]."</td>";
//echo "<td>".$result["caption"]."</td>";
//echo "<td><a href='search.php?query=".$result['caption']."' > <img src='resources/".$result["url"]."' alt='' style='width:200px; height:auto;'></a></td>";
//echo "</tr>";
}
mysqli_close($con);
echo "</table>";
}
?>
</body>
<script>
function showValue(newValue){
document.getElementById("range").innerHTML=newValue;
}
var flag = true;
function hideTR(){
//change the CSS style property to 'none' for hiding, or 'inline' to show
if(flag)
{
document.getElementById('hideThis').style.display='inline';
flag = false;
}
else
{
document.getElementById('hideThis').style.display='none';
flag = true;
}
}
</script>
</html>