-
Notifications
You must be signed in to change notification settings - Fork 0
/
surveyinfo.php
34 lines (29 loc) · 1.07 KB
/
surveyinfo.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
<?php
header('Access-Control-Allow-Origin: *');
$username = 'contwzvk_honey';
$database = 'contwzvk_Survey';
$localhost = 'localhost';
$password = 'rocking_143';
//$con = mysqli_connect('localhost', $username, $password, $database);
$link = mysql_connect($localhost, $username, $password);
$db_selected = mysql_select_db($database, $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
$request = file_get_contents('php://input');
$input = json_decode($request,true);
$userID = $input['userID'];
$surveyID = uniqid();
$surveyTitle = $input['title'];
$category = $input['category'];
$date = $input['date'];
//$userID = '1';
//$surveyID = uniqid();
//$surveyTitle = 'C';
//echo "userid : " . $userID ;
$query = "INSERT INTO SurveyInfo VALUES ('$userID', '$surveyID', '$surveyTitle', '$category', '$date')";
mysql_query($query) or die("error");
$resultArray['status'] = '800';
$resultArray['surveyID'] = $surveyID;
echo json_encode($resultArray);
?>