質問編集履歴
2
編集前の状態に戻しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,183 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+

|
2
|
+
削除ボタンを押すと次のようなエラーが出ます
|
3
|
+
エラーメッセージ
|
4
|
+
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'year='2020',month='12',day='3',week='木曜日',time1='9',time2='21',g_name='西' at line 1' in C:\eclipse-php\xampp\htdocs\kenkyuu\schedule_delete_done.php on line 31
|
5
|
+
|
6
|
+
schedule_delete_done.phpファイル
|
5
7
|
```php
|
6
8
|
<!DOCTYPE html>
|
7
|
-
<html><head>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
9
|
-
<title>スケジュール編集</title>
|
10
|
-
<style>
|
11
|
-
.sun{color: red;}
|
12
|
-
.sat{color: blue;}
|
13
|
-
#content{
|
14
|
-
padding: 20px;
|
15
|
-
width: 720px;
|
16
|
-
min-height: 490px;
|
17
|
-
margin: 0 auto;
|
18
|
-
margin-bottom: 10px;
|
19
|
-
font-size: 153.9%;
|
20
|
-
}
|
21
9
|
|
22
|
-
|
10
|
+
<html>
|
11
|
+
<head>
|
12
|
+
<meta charset="UTF-8">
|
13
|
+
|
14
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
16
|
+
<title>仮予約</title>
|
17
|
+
|
18
|
+
<style type="text/css">
|
19
|
+
|
23
20
|
</style>
|
24
21
|
</head>
|
22
|
+
|
25
23
|
<body>
|
26
|
-
|
27
|
-
<?php
|
24
|
+
<?php
|
28
|
-
session_start();
|
29
|
-
require("nav_user.php");
|
30
|
-
require('dbconnect.php');
|
25
|
+
require('dbconnect.php');
|
31
26
|
|
32
|
-
$year = date('Y');
|
33
|
-
$month = date('m');
|
34
|
-
if(isset($_GET["month"])){
|
35
|
-
$month = $_GET["month"];
|
36
|
-
if(isset($_GET["year"])){
|
37
|
-
$year = $_GET["year"];
|
38
|
-
if(isset($_GET["btn"])){
|
39
|
-
if($_GET["btn"] == 'next'){
|
40
|
-
$month = $month+1;
|
41
|
-
if($month == 13){
|
42
|
-
$month = 1;
|
43
|
-
$year = $year+1;
|
44
|
-
}
|
45
|
-
|
27
|
+
$del = $db->prepare('delete from reservation where facility=?,year=?,month=?,day=?,week=?,time1=?,time2=?,g_name=?');
|
46
|
-
$month = $month-1;
|
47
|
-
if($month == 0){
|
48
|
-
$month = 12;
|
49
|
-
$year = $year-1;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
}
|
56
28
|
|
29
|
+
$del->execute(array(
|
57
|
-
|
30
|
+
$_GET['facility'],
|
58
|
-
|
31
|
+
$_GET['year'],
|
59
|
-
|
32
|
+
$_GET['month'],
|
60
|
-
|
33
|
+
$_GET['day'],
|
61
|
-
// echo $month+1;
|
62
|
-
|
34
|
+
$_GET['week'],
|
63
|
-
|
35
|
+
$_GET['time1'],
|
36
|
+
$_GET['time2'],
|
37
|
+
$_GET['g_name'],
|
38
|
+
));
|
39
|
+
print '削除しました';
|
40
|
+
?>
|
64
41
|
|
65
|
-
|
42
|
+
<a href="schedule.php">戻る</a>
|
66
43
|
|
67
|
-
$reservations->execute(array(
|
68
|
-
$year,$month
|
69
|
-
));
|
70
|
-
$monthly=[];//予定が空のときに処理
|
71
|
-
while($reservation = $reservations->fetch()){
|
72
|
-
$monthly[$reservation['day']][] = array($reservation['time1'],$reservation['time2'],$reservation['g_name']);
|
73
|
-
}
|
74
|
-
// ksort($monthly);
|
75
|
-
// print_r($monthly);
|
76
|
-
// print $reservation['time2'];
|
77
|
-
// exit;
|
78
|
-
|
79
|
-
// 一か月分の日付を曜日付きで出力する
|
80
|
-
$lastd = 31;//$yearと$monthから計算して求める
|
81
|
-
$time = mktime(0, 0, 0, $month + 1, 0, $year);
|
82
|
-
$lastd = date('d',$time);
|
83
|
-
//時区間分割を実現する
|
84
|
-
$divided=[];
|
85
|
-
for ($d=1; $d<= $lastd; $d++){
|
86
|
-
if (array_key_exists($d, $monthly)){
|
87
|
-
//配列のキーが存在するか調べる(キー、対象の配列)
|
88
|
-
//この日に予定があれば、分割していく
|
89
|
-
$intv = [[9,21,'']];
|
90
|
-
foreach ($monthly[$d] as $yotei){//(対象配列 as その中身)、$yoteiは[x,y,z]
|
91
|
-
$intv= div($intv, $yotei);
|
92
|
-
}
|
93
|
-
$divided[$d] = $intv;//=[x,y,z]
|
94
|
-
}else{
|
95
|
-
$divided[$d] = [[9,21,'']];
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
//print_r($divided);
|
100
|
-
//exit;
|
101
|
-
echo '<div id="content">';
|
102
|
-
echo '<table border=1>';
|
103
|
-
echo '<h2>スケジュール編集</h2> ';
|
104
|
-
// echo '<ul class="nav nav-tabs" role="tablist">
|
105
|
-
// <li class="nav-item">
|
106
|
-
// <a class="nav-link active" id="item1-tab" data-toggle="tab" href="#item1" role="tab" aria-controls="item1" aria-selected="true">野球場</a>
|
107
|
-
// </li>
|
108
|
-
// <li class="nav-item">
|
109
|
-
// <a class="nav-link" id="item2-tab" data-toggle="tab" href="#item2" role="tab" aria-controls="item2" aria-selected="false">テニスコート</a>
|
110
|
-
// </li>
|
111
|
-
// </ul>';
|
112
|
-
echo "<h3>{$year}年{$month}月</h3>";
|
113
|
-
echo "<a class='btn btn-info' href='?year=$year&month=$month&btn=prev'>前月</a>";
|
114
|
-
echo "<a class='btn btn-info' href='#'>引き継ぐ</a>";
|
115
|
-
echo "<a class='btn btn-info' href='?year=$year&month=$month&btn=next'>次月</a>";
|
116
|
-
echo '<tr><td></td>';
|
117
|
-
for ($h=9; $h<22; $h++){
|
118
|
-
echo '<td >', $h, '</td>';
|
119
|
-
}
|
120
|
-
echo '</tr>';
|
121
|
-
for ($d=1; $d<=$lastd; $d++){
|
122
|
-
$time = mktime(0, 0, 0, $month, $d, $year);
|
123
|
-
$w = date('w',$time);
|
124
|
-
$wdays = array('日','月','火','水','木','金','土',);
|
125
|
-
$class = '';
|
126
|
-
if ($w==0) $class='sun';
|
127
|
-
if ($w==6) $class='sat';
|
128
|
-
echo '<tr>';
|
129
|
-
echo '<td><span class="'.$class.'">', $d,'('. $wdays[$w].')</span>'. '</td>';
|
130
|
-
$yotei = $divided[$d];
|
131
|
-
foreach ($yotei as $y){//$yotei=$divided[$d]=[x,y,z]
|
132
|
-
$y1 = $y[0];//[x,y,z]のx
|
133
|
-
$y2 = $y[1];//[x,y,z]のy
|
134
|
-
$y3 = $y[2];//[x,y,z]のz
|
135
|
-
$colspan=$y2-$y1+1;
|
136
|
-
if(!empty($y3)){
|
137
|
-
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?id='.$reservation['id_reservation'].'y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'&facility='.$f.'&gm='.$y3.'">'.$y3.'</a></td>';
|
138
|
-
}else{
|
139
|
-
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'">○</a></td>';
|
140
|
-
}
|
141
|
-
|
142
|
-
}
|
143
|
-
echo '</tr>';
|
144
|
-
}
|
145
|
-
echo '</table>';
|
146
|
-
echo '</div>';
|
147
|
-
?>
|
148
44
|
</body>
|
149
|
-
|
150
|
-
<?php
|
151
|
-
//div.phpからコピーしたもの
|
152
|
-
function div($intv, $a){
|
153
|
-
// $a=[11,12,''] =(div)=> $intv=[[9,10,''],[11,12,'試合'],[13,21,'']]
|
154
|
-
$a1 = $a[0];
|
155
|
-
$a2 = $a[1];
|
156
|
-
$a3 = $a[2];//追加
|
157
|
-
$out = [];
|
158
|
-
for ($i=0; $i<count($intv); $i++){
|
159
|
-
$b1 = $intv[$i][0];
|
160
|
-
$b2 = $intv[$i][1];
|
161
|
-
$b3 = $intv[$i][2];//追加
|
162
|
-
|
163
|
-
if ($a1 >= $b1 and $a2 <= $b2){
|
164
|
-
if ($b1<=$a1-1)
|
165
|
-
$out[]=[$b1, $a1-1, $b3]; //$b3を追加
|
166
|
-
$out[]=[$a1, $a2, $a3]; //$a3を追加
|
167
|
-
if ($a2+1<=$b2)
|
168
|
-
$out[]=[$a2+1,$b2, $b3]; //$b3を追加
|
169
|
-
}else{
|
170
|
-
$out[] = $intv[$i];
|
171
|
-
}
|
172
|
-
}
|
173
|
-
return $out;
|
174
|
-
}
|
175
|
-
?>
|
176
|
-
```
|
177
|
-
こちらのコードの
|
178
|
-
```php
|
179
|
-
if(!empty($y3)){
|
180
|
-
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?id='.$reservation['id_reservation'].'y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'&facility='.$f.'&gm='.$y3.'">'.$y3.'</a></td>';
|
181
|
-
}
|
182
|
-
```
|
183
|
-
id='.$reservation['id_reservation'].'で値を渡したいと考えているのですが上手くいかないです。
|
45
|
+
```
|
1
ID指定の場合
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,245 +1,183 @@
|
|
1
|
+
ID指定の場合
|
1
|
-

|
2
|
-
ここで削除を押して
|
3
|
-
|
3
|
+
この画面で削除したい項目を選択した際にURLパラメータとしてID(reservation_id)を渡すことができればいいのではと考えました
|
4
|
-
|
4
|
+
こちらのコードは次のようになっています
|
5
|
-
追加・削除画面
|
6
5
|
```php
|
6
|
+
<!DOCTYPE html>
|
7
|
+
<html><head>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
9
|
+
<title>スケジュール編集</title>
|
7
|
-
<
|
10
|
+
<style>
|
11
|
+
.sun{color: red;}
|
12
|
+
.sat{color: blue;}
|
13
|
+
#content{
|
14
|
+
padding: 20px;
|
15
|
+
width: 720px;
|
16
|
+
min-height: 490px;
|
8
|
-
|
17
|
+
margin: 0 auto;
|
9
|
-
require('dbconnect.php');
|
10
|
-
require("nav_user.php");
|
11
|
-
|
12
|
-
// if(isset($_GET['y']) and isset($_GET['m']) and isset($_GET['d']) and isset($_GET['w']) and isset($_GET['t1']) and isset($_GET['t2']) and isset($_GET['qm'])) {
|
13
|
-
// $y = $_GET['y'];
|
14
|
-
// $m = $_GET['m'];
|
15
|
-
// $d = $_GET['d'];
|
16
|
-
// $w = $_GET['w'];
|
17
|
-
// $t1 = $_GET['t1'];
|
18
|
-
// $t2 = $_GET['t2'];
|
19
|
-
// $qm = $_GET['qm'];
|
20
|
-
// }
|
21
|
-
|
22
|
-
if(isset($_GET['y']))
|
23
|
-
{
|
24
|
-
|
18
|
+
margin-bottom: 10px;
|
25
|
-
} else {
|
26
|
-
|
19
|
+
font-size: 153.9%;
|
27
20
|
}
|
28
|
-
if(isset($_GET['m']))
|
29
|
-
{
|
30
|
-
$m = $_GET['m'];
|
31
|
-
} else {
|
32
|
-
$m = null;
|
33
|
-
}
|
34
|
-
if(isset($_GET['d']))
|
35
|
-
{
|
36
|
-
$d = $_GET['d'];
|
37
|
-
} else {
|
38
|
-
$d = null;
|
39
|
-
}
|
40
|
-
if(isset($_GET['w']))
|
41
|
-
{
|
42
|
-
$w = $_GET['w'];
|
43
|
-
} else {
|
44
|
-
$w = null;
|
45
|
-
}
|
46
|
-
if(isset($_GET['t1']))
|
47
|
-
{
|
48
|
-
$t1 = $_GET['t1'];
|
49
|
-
} else {
|
50
|
-
$t1 = null;
|
51
|
-
}
|
52
|
-
if(isset($_GET['t2']))
|
53
|
-
{
|
54
|
-
$t2 = $_GET['t2'];
|
55
|
-
} else {
|
56
|
-
$t2 = null;
|
57
|
-
}
|
58
|
-
if(isset($_GET['gm']))
|
59
|
-
{
|
60
|
-
$gm = $_GET['gm'];
|
61
|
-
} else {
|
62
|
-
$gm = null;
|
63
|
-
}
|
64
21
|
|
65
|
-
|
22
|
+
|
66
|
-
|
67
|
-
// $y = filter_input( INPUT_GET, 'y' );
|
68
|
-
// $m = filter_input( INPUT_GET, 'm' );
|
69
|
-
// $d = filter_input( INPUT_GET, 'd' );
|
70
|
-
// $w = filter_input( INPUT_GET, 'w' );
|
71
|
-
// $t1 = filter_input( INPUT_GET, 't1' );
|
72
|
-
// $t2 = filter_input( INPUT_GET, 't2' );
|
73
|
-
// $qm = filter_input( INPUT_GET, 'qm' );
|
74
|
-
// echo $qm;
|
75
|
-
// exit;
|
76
|
-
|
77
|
-
?>
|
78
|
-
|
79
|
-
<!DOCTYPE html>
|
80
|
-
|
81
|
-
<html>
|
82
|
-
<head>
|
83
|
-
<meta charset="UTF-8">
|
84
|
-
|
85
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
86
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
87
|
-
<title>追加・削除</title>
|
88
|
-
|
89
|
-
<style type="text/css">
|
90
|
-
|
91
23
|
</style>
|
92
24
|
</head>
|
93
|
-
|
94
25
|
<body>
|
95
|
-
|
96
|
-
|
26
|
+
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<h3>追加</h3>
|
101
|
-
<form action="schedule_branch.php" method="post" enctype="multipart/form-data">
|
102
|
-
<input type="button" onclick="history.back()" value="戻る">
|
103
|
-
<input type="submit" name="add" value="追加">
|
104
|
-
|
105
|
-
<input type="submit" name="delete" value="削除">
|
106
|
-
|
107
|
-
<!-- <input type="submit" value="仮予約" /> -->
|
108
|
-
<p>施設名<input type="text" name="facility" size="10" value="<?php echo $baseball ;?>"></p>
|
109
|
-
<p>使用日<input type="text" name="year" size="2" value="<?php echo $y ;?>">年
|
110
|
-
<input type="text" name="month" size="1" value="<?php echo $m ;?>">月
|
111
|
-
<input type="text" name="day" size="1" value="<?php echo $d ;?>">日
|
112
|
-
<input type="text" name="week" size="4" value="<?php echo $w.'曜日' ;?>">
|
113
|
-
|
27
|
+
<?php
|
114
|
-
<p>行事名<input type="text" name="g_name" size="20" value="<?php echo $gm ;?>"></p>
|
115
|
-
|
28
|
+
session_start();
|
116
|
-
|
29
|
+
require("nav_user.php");
|
117
|
-
<?php for($t1;$t1<$t2;$t1++){
|
118
|
-
print('<option value="' .$t1. '">' .$t1. ' 時</option> ');
|
119
|
-
}
|
120
|
-
?>
|
121
|
-
|
30
|
+
require('dbconnect.php');
|
122
31
|
|
32
|
+
$year = date('Y');
|
33
|
+
$month = date('m');
|
123
|
-
|
34
|
+
if(isset($_GET["month"])){
|
35
|
+
$month = $_GET["month"];
|
36
|
+
if(isset($_GET["year"])){
|
37
|
+
$year = $_GET["year"];
|
124
|
-
|
38
|
+
if(isset($_GET["btn"])){
|
39
|
+
if($_GET["btn"] == 'next'){
|
40
|
+
$month = $month+1;
|
41
|
+
if($month == 13){
|
42
|
+
$month = 1;
|
43
|
+
$year = $year+1;
|
44
|
+
}
|
125
|
-
|
45
|
+
}elseif($_GET["btn"] == 'prev'){
|
46
|
+
$month = $month-1;
|
47
|
+
if($month == 0){
|
48
|
+
$month = 12;
|
49
|
+
$year = $year-1;
|
50
|
+
}
|
51
|
+
}
|
126
52
|
}
|
127
|
-
|
128
|
-
?>
|
129
|
-
</select>
|
130
|
-
<table class="table table-striped table-bordered" >
|
131
|
-
<tr>
|
132
|
-
<?php if($w=='土' || $w=='日') :?>
|
133
|
-
<td>土日予約セット</td>
|
134
|
-
</tr>
|
135
|
-
<tr>
|
136
|
-
<td>
|
137
|
-
<a href="#" class="btn btn-primary" role="button"><?php
|
138
|
-
$e = $d +1;
|
139
|
-
echo "{$d}日(土){$e}日(日)" ;?></a>
|
140
|
-
</td>
|
141
|
-
<?php endif; ?>
|
142
|
-
</tr>
|
143
|
-
<tr>
|
144
|
-
<td>毎週予約セット</td>
|
145
|
-
</tr>
|
146
|
-
<tr>
|
147
|
-
<td>
|
148
|
-
<ul>
|
149
|
-
<li>
|
150
|
-
|
53
|
+
}
|
151
|
-
<a href="#" class="btn btn-primary" role="button">4日(土)11日(土)18日(土)25日(土)</a>
|
152
|
-
</li>
|
153
|
-
</td>
|
154
|
-
</tr>
|
155
|
-
</form>
|
156
54
|
|
157
|
-
</table>
|
158
|
-
|
159
|
-
|
55
|
+
}
|
160
|
-
</html>
|
161
56
|
|
57
|
+
//linkでやる12月の次の処理、linkにyearを追加
|
162
|
-
|
58
|
+
// else{
|
163
|
-
|
59
|
+
// $month = date('m');
|
164
|
-
|
60
|
+
// }
|
61
|
+
// echo $month+1;
|
62
|
+
// exit;
|
63
|
+
|
165
64
|
|
166
|
-
<?php
|
167
|
-
|
65
|
+
$reservations = $db->prepare('select * from reservation where year=? and month=?');
|
168
66
|
|
67
|
+
$reservations->execute(array(
|
68
|
+
$year,$month
|
69
|
+
));
|
169
|
-
|
70
|
+
$monthly=[];//予定が空のときに処理
|
71
|
+
while($reservation = $reservations->fetch()){
|
72
|
+
$monthly[$reservation['day']][] = array($reservation['time1'],$reservation['time2'],$reservation['g_name']);
|
73
|
+
}
|
74
|
+
// ksort($monthly);
|
75
|
+
// print_r($monthly);
|
76
|
+
// print $reservation['time2'];
|
77
|
+
// exit;
|
170
78
|
|
79
|
+
// 一か月分の日付を曜日付きで出力する
|
80
|
+
$lastd = 31;//$yearと$monthから計算して求める
|
81
|
+
$time = mktime(0, 0, 0, $month + 1, 0, $year);
|
171
|
-
|
82
|
+
$lastd = date('d',$time);
|
83
|
+
//時区間分割を実現する
|
84
|
+
$divided=[];
|
85
|
+
for ($d=1; $d<= $lastd; $d++){
|
86
|
+
if (array_key_exists($d, $monthly)){
|
87
|
+
//配列のキーが存在するか調べる(キー、対象の配列)
|
88
|
+
//この日に予定があれば、分割していく
|
172
|
-
|
89
|
+
$intv = [[9,21,'']];
|
90
|
+
foreach ($monthly[$d] as $yotei){//(対象配列 as その中身)、$yoteiは[x,y,z]
|
91
|
+
$intv= div($intv, $yotei);
|
92
|
+
}
|
173
|
-
|
93
|
+
$divided[$d] = $intv;//=[x,y,z]
|
94
|
+
}else{
|
174
|
-
|
95
|
+
$divided[$d] = [[9,21,'']];
|
175
|
-
|
96
|
+
}
|
176
|
-
|
97
|
+
}
|
177
|
-
$schedule_time2=$_POST['time2'];
|
178
|
-
$schedule_g_name=$_POST['g_name'];
|
179
98
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
99
|
+
//print_r($divided);
|
100
|
+
//exit;
|
101
|
+
echo '<div id="content">';
|
102
|
+
echo '<table border=1>';
|
103
|
+
echo '<h2>スケジュール編集</h2> ';
|
104
|
+
// echo '<ul class="nav nav-tabs" role="tablist">
|
105
|
+
// <li class="nav-item">
|
106
|
+
// <a class="nav-link active" id="item1-tab" data-toggle="tab" href="#item1" role="tab" aria-controls="item1" aria-selected="true">野球場</a>
|
107
|
+
// </li>
|
108
|
+
// <li class="nav-item">
|
109
|
+
// <a class="nav-link" id="item2-tab" data-toggle="tab" href="#item2" role="tab" aria-controls="item2" aria-selected="false">テニスコート</a>
|
110
|
+
// </li>
|
111
|
+
// </ul>';
|
112
|
+
echo "<h3>{$year}年{$month}月</h3>";
|
113
|
+
echo "<a class='btn btn-info' href='?year=$year&month=$month&btn=prev'>前月</a>";
|
114
|
+
echo "<a class='btn btn-info' href='#'>引き継ぐ</a>";
|
115
|
+
echo "<a class='btn btn-info' href='?year=$year&month=$month&btn=next'>次月</a>";
|
116
|
+
echo '<tr><td></td>';
|
117
|
+
for ($h=9; $h<22; $h++){
|
118
|
+
echo '<td >', $h, '</td>';
|
119
|
+
}
|
120
|
+
echo '</tr>';
|
121
|
+
for ($d=1; $d<=$lastd; $d++){
|
122
|
+
$time = mktime(0, 0, 0, $month, $d, $year);
|
123
|
+
$w = date('w',$time);
|
124
|
+
$wdays = array('日','月','火','水','木','金','土',);
|
125
|
+
$class = '';
|
126
|
+
if ($w==0) $class='sun';
|
127
|
+
if ($w==6) $class='sat';
|
128
|
+
echo '<tr>';
|
129
|
+
echo '<td><span class="'.$class.'">', $d,'('. $wdays[$w].')</span>'. '</td>';
|
130
|
+
$yotei = $divided[$d];
|
131
|
+
foreach ($yotei as $y){//$yotei=$divided[$d]=[x,y,z]
|
132
|
+
$y1 = $y[0];//[x,y,z]のx
|
133
|
+
$y2 = $y[1];//[x,y,z]のy
|
134
|
+
$y3 = $y[2];//[x,y,z]のz
|
135
|
+
$colspan=$y2-$y1+1;
|
136
|
+
if(!empty($y3)){
|
137
|
+
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?id='.$reservation['id_reservation'].'y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'&facility='.$f.'&gm='.$y3.'">'.$y3.'</a></td>';
|
138
|
+
}else{
|
139
|
+
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'">○</a></td>';
|
140
|
+
}
|
141
|
+
|
142
|
+
}
|
143
|
+
echo '</tr>';
|
144
|
+
}
|
145
|
+
echo '</table>';
|
146
|
+
echo '</div>';
|
197
147
|
?>
|
198
|
-
```
|
199
|
-
こちらが削除(delete)の処理です。
|
200
|
-
```php
|
201
|
-
<!DOCTYPE html>
|
202
|
-
|
203
|
-
<html>
|
204
|
-
<
|
148
|
+
</body>
|
205
|
-
<meta charset="UTF-8">
|
206
|
-
|
207
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
208
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
209
|
-
<title>仮予約</title>
|
210
|
-
|
211
|
-
<style type="text/css">
|
212
|
-
|
213
|
-
</
|
149
|
+
</html>
|
214
|
-
</head>
|
215
|
-
|
216
|
-
<body>
|
217
150
|
<?php
|
218
|
-
|
151
|
+
//div.phpからコピーしたもの
|
152
|
+
function div($intv, $a){
|
153
|
+
// $a=[11,12,''] =(div)=> $intv=[[9,10,''],[11,12,'試合'],[13,21,'']]
|
154
|
+
$a1 = $a[0];
|
155
|
+
$a2 = $a[1];
|
156
|
+
$a3 = $a[2];//追加
|
157
|
+
$out = [];
|
158
|
+
for ($i=0; $i<count($intv); $i++){
|
159
|
+
$b1 = $intv[$i][0];
|
160
|
+
$b2 = $intv[$i][1];
|
161
|
+
$b3 = $intv[$i][2];//追加
|
219
162
|
|
220
|
-
|
163
|
+
if ($a1 >= $b1 and $a2 <= $b2){
|
221
|
-
|
222
|
-
|
164
|
+
if ($b1<=$a1-1)
|
165
|
+
$out[]=[$b1, $a1-1, $b3]; //$b3を追加
|
223
|
-
|
166
|
+
$out[]=[$a1, $a2, $a3]; //$a3を追加
|
167
|
+
if ($a2+1<=$b2)
|
224
|
-
|
168
|
+
$out[]=[$a2+1,$b2, $b3]; //$b3を追加
|
169
|
+
}else{
|
225
|
-
|
170
|
+
$out[] = $intv[$i];
|
226
|
-
$_GET['day'],
|
227
|
-
$_GET['week'],
|
228
|
-
$_GET['time1'],
|
229
|
-
$_GET['time2'],
|
230
|
-
$_GET['g_name'],
|
231
|
-
|
171
|
+
}
|
172
|
+
}
|
232
|
-
|
173
|
+
return $out;
|
174
|
+
}
|
233
175
|
?>
|
234
|
-
|
235
|
-
<a href="schedule.php">戻る</a>
|
236
|
-
|
237
|
-
</body>
|
238
176
|
```
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
177
|
+
こちらのコードの
|
178
|
+
```php
|
179
|
+
if(!empty($y3)){
|
180
|
+
echo '<td colspan="'. $colspan . '"><a href="schedule_add_delete.php?id='.$reservation['id_reservation'].'y='.$year.'&m='.$month.'&d='.$d.'&w='.$wdays[$w].'&t1='.$y1.'&t2='.$y2.'&facility='.$f.'&gm='.$y3.'">'.$y3.'</a></td>';
|
181
|
+
}
|
182
|
+
```
|
183
|
+
id='.$reservation['id_reservation'].'で値を渡したいと考えているのですが上手くいかないです。
|