-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtableInput.php
49 lines (40 loc) · 1.13 KB
/
tableInput.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
<?php
session_start();
header("Content-Type:text/html;charset=utf-8");
$host = '127.0.0.1';
$user = 'root';
$pw = 'chanki';
$dbName = 'healthcare';
$port = 3306;
$mysqli = new mysqli($host, $user, $pw, $dbName,$port);
if($mysqli === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$letter=$_POST['table'];
$open=$_POST['open'];
$teaminfo = $_SESSION['login_session']['teamName'];
$name = $_SESSION['login_session']['name'];
$id = $_SESSION['login_session']['memberId'];
$time = date("Y-m-d");
$sql = "insert into shorttable (name,letter,time,open,teamname,memberId)";
$sql = $sql. "values('$name','$letter','$time','$open','$teaminfo','$id')";
if(!$letter){
echo "<script>alert('텍스트를 입력해주세요'); location.href='/shorttable.php'; </script>";
}
else{
if(!$sql )
{
die('Could not update data: ' . mysqli_error());
}
if($mysqli->query($sql)){
echo("<script>location.replace('./shorttable.php');</script>");
}
else{
echo '에러가 발생했습니다. 다시 시도해 주세요.';
echo "Query: " . $sql . "\n";
echo "Errno: " . $mysqli->errno . "\n";
echo "Error: " . $mysqli->error . "\n";
exit;
}
}
?>