-
Notifications
You must be signed in to change notification settings - Fork 0
/
servicefollow.php
43 lines (33 loc) · 1008 Bytes
/
servicefollow.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
<?php
$host = "localhost"; //database host server
$db = "fritter"; //database name
$user = "root"; //database user
$pass = ""; //password
//Check to see if we can connect to the server
$connection = mysql_connect($host, $user, $pass);
$followerID = $_POST['followerID'];
$followedID = $_POST['followedID'];
if(!$connection)
{
die("Database server connection failed.");
}
else
{
//Attempt to select the database
$dbconnect = mysql_select_db("fritter", $connection);
//Check to see if we could select the database
if(!$dbconnect)
{
die("Unable to connect to the specified database!");
}
else
{
$query = "INSERT INTO following(followerID,followedID)
VALUES('$followerID' ,'$followedID')";
$resultset = mysql_query($query, $connection);
$response = "Successfully added " . $query;
//echo "Successfully added ";
}
echo json_encode($response);
}
?>