-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
45 lines (43 loc) · 1.19 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Search-BLRS</title>
</head>
<body>
<?php
$host = "host=127.0.0.1";
$port = "port=5432";
$dbname = "dbname=Project";
$credentials = "user=postgres password=saivignan";
$s1=$_GET["userid"];
$s2=$_GET["searchtext"];
// $sai3=$_GET["sup"];
$db = pg_connect( "$host $port $dbname $credentials" );
if(!$db){
echo "Error : Unable to open database\n";
}
function redirect($url, $statusCode = 303)
{
header('Location: ' . $url, true, $statusCode);
die();
}
$sql ="select title from papers2 where papers2.title::text ilike '%query optimization%'";
$ret = pg_query($db, $sql);
if(!$ret){
echo pg_last_error($db);
}
$row = pg_fetch_row($ret);
if ($row[0]>=1){
redirect('http://localhost/Dbproject/searchresults.php',303);
}
else {
echo "No Reults go back to search";
}
// if ($sai3){
// redirect('http://localhost/Dbproject/Signup.php',303);
// }
pg_close($db);
?>
</body>
</html>