-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheroku1.php
executable file
·59 lines (38 loc) · 1.17 KB
/
heroku1.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
<?php
//connect to the database.
$link = pg_connect("host=ec2-54-235-74-57.compute-1.amazonaws.com port=5432 dbname=d1gueknm6h2psa user=pwbtzrsrgvgqrq password=AavMrCiPYOhYhVHj173a2tS2EZ sslmode=require options='--client_encoding=UTF8'");
if (!$link) {
die("Error in connection: " . pg_last_error());
}
//Get the data
$Query = "";
$radio_option = $_GET['person'];
$search_text = $_GET['search_text'];
if($radio_option == 'name')
{
$Query = "SELECT * FROM search WHERE doc_name = '".$search_text."'";
}
if($radio_option == 'speciality')
{
$Query = "SELECT * FROM search WHERE speciality = '".$search_text."'";
}
if($radio_option == 'loc')
{
$Query = "SELECT * FROM search WHERE loc = '".$search_text."'";
}
//$Query = "SELECT * FROM search WHERE doc_name = 'susan'";
$Result = pg_query($link,$Query); //Execute the query
$json = array();
$row = true;
while ($row = pg_fetch_row($Result)){
/*$json['name'] = $row['doc_name'];
$json['speciality'] = $row['speciality'];
$json['location'] = $row['loc'];
$json['avail'] = $row['avail'];
$json['time'] = $row['time'];*/
$json[] = $row;
}
echo $json_data = json_encode($json);
pg_free_result($Result);
pg_close();
?>