-
Notifications
You must be signed in to change notification settings - Fork 3
/
api_add.php
30 lines (27 loc) · 1.17 KB
/
api_add.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
<?php
$connectionInfo = [
"UID" => "atsushi@aktiva-archive",
"pwd" => "Shigoto4510",
"Database" => "aktiva-archive-db",
"CharacterSet" => "UTF-8"
];
$serverName = "tcp:aktiva-archive.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
if($conn === false) {
print('<p>データベースへの接続に失敗しました。</p>');
foreach(sqlsrv_errors() as $error)
print("Error: " . $error["message"]);
sqlsrv_close($conn);
exit();
}
$query = "insert into history(user_id, music_id, date, score, part, body, timing, expression, comment) values('" . $_GET["user"] . "', '" . $_GET["song"]. "', '" . $_GET["date"] . "', '" . $_GET["total"] . "', '" . $_GET["part"] . "' ,'" . $_GET["body"] . "', '" . $_GET["timing"] . "', '" . $_GET["expression"] . "', '" . $_GET["comment"] . "');";
$result = sqlsrv_query($conn, $query);
if($result === false) {
print('<p>クエリーが失敗しました。</p>');
foreach(sqlsrv_errors() as $error)
print("Error: " . $error["message"]);
sqlsrv_close($conn);
exit();
}
echo "1";
?>