質問編集履歴

8

文章変更

2019/04/22 07:20

投稿

1090175
1090175

スコア6

test CHANGED
@@ -1 +1 @@
1
- 日付、時間帯を指定できる予約システム(美容院)
1
+ 日付、時間帯を指定できる予約システム
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- 予約サイトの画面を作成しています。
7
+ 予約サイトの画面を作成しています。(美容院や歯医者などをイメージしています)
8
8
 
9
9
  ユーザーが日付を選択したら、DBを見て空いてる時間だけを表示する
10
10
 

7

スペルミス

2019/04/22 07:20

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -220,7 +220,7 @@
220
220
 
221
221
  date: $('#date_schedule').val()
222
222
 
223
- },finction(time) {
223
+ },function(time) {
224
224
 
225
225
  $('#result').html(time);
226
226
 

6

スペルミス

2019/04/22 03:59

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -216,7 +216,7 @@
216
216
 
217
217
  $('#date_chose').click(function() {
218
218
 
219
- $.post('acrtionReservation.php',{
219
+ $.post('actionReservation.php',{
220
220
 
221
221
  date: $('#date_schedule').val()
222
222
 

5

タイトル変更

2019/04/22 03:57

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -182,7 +182,7 @@
182
182
 
183
183
  <div class="container py-3">
184
184
 
185
- <h2><a href="index.php" class="text-white">愛&D歯科</a></h2>
185
+ <h2><a href="index.php" class="text-white">美容院</a></h2>
186
186
 
187
187
  </div>
188
188
 

4

タイトル

2019/04/22 02:04

投稿

1090175
1090175

スコア6

test CHANGED
@@ -1 +1 @@
1
- phpで予約システム
1
+ 日付、時間帯を指定きる予約システム(美容院)
test CHANGED
File without changes

3

ソースコード追加

2019/04/22 00:27

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,7 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
+ -実装するのに当たってbootstrap4を使用しています。
4
+
3
5
 
4
6
 
5
7
  予約サイトの画面を作成しています。
@@ -14,19 +16,35 @@
14
16
 
15
17
 
16
18
 
19
+ 画像イメージ
20
+
21
+ ---
22
+
23
+
24
+
25
+ 日付選択前
26
+
27
+ ![イメージ説明](25ee24669a2f8187877a0f2552f55ab5.png)
28
+
29
+
30
+
31
+ 日付選択後
32
+
17
- ![イメージ説明](67a1c240f45fe3b0d503ff3b71a34911.png)
33
+ ![イメージ説明](d43e0ae5fead181b76fd41cb7890aa45.png)
18
-
19
-
20
-
21
-
22
-
34
+
35
+
36
+
37
+
38
+
23
- 0. 日付選択されたら schedule_table を見にいき同じ日付のデータをSELECTする
39
+ 0. 日付選択しchoseを押下後 schedule_table を見にいき同じ日付のデータをSELECTする
24
40
 
25
41
  SELECT time_id FROM schedule_table WHERE date = 選択された日付
26
42
 
27
43
 
28
44
 
45
+ 0. schedule_tableにない時間のものをドロップダウン式で選択できるように表示する。
46
+
29
- 0. SELECT time FROM time_table WHERE time_id != (上でSELECTしたデータのtime_id)
47
+   SELECT time FROM time_table WHERE time_id != (上でSELECTしたデータのtime_id)
30
48
 
31
49
 
32
50
 
@@ -84,4 +102,266 @@
84
102
 
85
103
  |1|2019-04-01|1|00101|
86
104
 
87
- |1|2019-04-01|3|00203|
105
+ |2|2019-04-01|3|00203|
106
+
107
+
108
+
109
+ schedule_id ---データを管理するのに使います
110
+
111
+ date time_id ---ユーザーが予約した時間、日付をインサートします
112
+
113
+ user_id ---他でuser情報を管理するtableがありそこと紐づけて誰が予約をしたかを見ます
114
+
115
+
116
+
117
+
118
+
119
+ ### 該当のソースコード
120
+
121
+ ```PHP
122
+
123
+ <?php
124
+
125
+ ini_set("display_errors", 1);
126
+
127
+ error_reporting(E_ALL);
128
+
129
+ ?>
130
+
131
+ <!doctype html>
132
+
133
+ <html lang="en">
134
+
135
+ <head>
136
+
137
+ <title>reservation</title>
138
+
139
+ <!-- Required meta tags -->
140
+
141
+ <meta charset="utf-8">
142
+
143
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
144
+
145
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
146
+
147
+ <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
148
+
149
+ <!-- <script type="text/javascript">
150
+
151
+ $.ajax({
152
+
153
+ success : function(response){
154
+
155
+ alert('成功');
156
+
157
+ },
158
+
159
+ error: function(){
160
+
161
+ //通信失敗時の処
162
+
163
+ alert('通信失敗');
164
+
165
+ }
166
+
167
+ });
168
+
169
+ </script> -->
170
+
171
+ <!-- Bootstrap CSS -->
172
+
173
+ <link href="css/reservation.css" rel="stylesheet" />
174
+
175
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
176
+
177
+ </head>
178
+
179
+ <body>
180
+
181
+ <header>
182
+
183
+ <div class="container py-3">
184
+
185
+ <h2><a href="index.php" class="text-white">愛&D歯科</a></h2>
186
+
187
+ </div>
188
+
189
+ </header>
190
+
191
+ <div class="row">
192
+
193
+ <div class="col-lg-4 visible-lg"></div>
194
+
195
+ <div class="col-lg-4">
196
+
197
+ <div class="container">
198
+
199
+ <form method="post" class="text-center mt-5">
200
+
201
+ <div class="form-group">
202
+
203
+ <label>Date:</label>
204
+
205
+ <input type="date" class="form-control date_schedule" name="date_schedule" id="date_schedule">
206
+
207
+ </div>
208
+
209
+ <div class="text-center mt-3">
210
+
211
+ <button class="btn bg-dark text-white" name="date_chose" id="date_chose">chose</button>
212
+
213
+ <script>
214
+
215
+ $(function() {
216
+
217
+ $('#date_chose').click(function() {
218
+
219
+ $.post('acrtionReservation.php',{
220
+
221
+ date: $('#date_schedule').val()
222
+
223
+ },finction(time) {
224
+
225
+ $('#result').html(time);
226
+
227
+ });
228
+
229
+ });
230
+
231
+ });
232
+
233
+ </script>
234
+
235
+ </div>
236
+
237
+ <!-- <div class="form-group mt-4">
238
+
239
+ <label>Time:</label>
240
+
241
+ <select class="form-control time-schedule" id="time-schedule" name="time_schedule">
242
+
243
+ <option></option>
244
+
245
+ </select>
246
+
247
+ </div>
248
+
249
+ <div class="text-center mt-4">
250
+
251
+ <button class="btn bg-dark text-white" name="reservation">submit</button>
252
+
253
+ </div> -->
254
+
255
+ </form>
256
+
257
+ </div>
258
+
259
+ </div>
260
+
261
+ <div class="col-lg-4 visible-lg"></div>
262
+
263
+ </div>
264
+
265
+ <footer class="mt-5">
266
+
267
+ <div class="container"></div>
268
+
269
+ </footer>
270
+
271
+ <!-- Optional JavaScript -->
272
+
273
+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
274
+
275
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
276
+
277
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
278
+
279
+ </body>
280
+
281
+ </html>
282
+
283
+
284
+
285
+ ```
286
+
287
+ SQLstatements.php
288
+
289
+ ```php
290
+
291
+ <?php
292
+
293
+
294
+
295
+ require_once "Database.php";
296
+
297
+
298
+
299
+ class User extends Database {
300
+
301
+
302
+
303
+ public function selectTime($date_schedule) {
304
+
305
+ $sql = "SELECT time_id FROM schedule WHERE date = '$date_schedule'";
306
+
307
+ $result = $this->conn->query($sql) or die('Connection error: '.$this->conn->error);
308
+
309
+ if($result) {
310
+
311
+ $sql = "SELECT time_id FROM time WHERE NOT '$result'";
312
+
313
+ $result = $this->conn->query($sql) or die('Connection error: '.$this->conn->error);
314
+
315
+ $row = $result->num_rows;
316
+
317
+ while($row = $result->fetch_assoc()) {
318
+
319
+ return $row['time'];
320
+
321
+ }
322
+
323
+ }
324
+
325
+ }
326
+
327
+
328
+
329
+ }
330
+
331
+
332
+
333
+ ?>
334
+
335
+ ```
336
+
337
+
338
+
339
+ actionReservation.php
340
+
341
+ ```php
342
+
343
+ <?php
344
+
345
+ session_start();
346
+
347
+ require "classes/SQLstatements.php";
348
+
349
+ ini_set("display_errors", 1);
350
+
351
+ error_reporting(E_ALL);
352
+
353
+
354
+
355
+ $user = new User;
356
+
357
+
358
+
359
+ $date_schedule = $_POST['date_schedule'];
360
+
361
+ $user->selectTime($date_schedule);
362
+
363
+ ?>
364
+
365
+
366
+
367
+ ```

2

文章追加

2019/04/22 00:25

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -33,6 +33,16 @@
33
33
 
34
34
 
35
35
 
36
+
37
+
38
+
39
+ このテーブル構造で上記の実装が可能なのか?
40
+
41
+ Ajaxでどのようにしたら上記のようなシステムが作成できるのか?
42
+
43
+ をご教示いただきたいです。
44
+
45
+ (Ajaxの知識が少なくこのシステムを作成するために今学習中です。)
36
46
 
37
47
 
38
48
 

1

文字の修正

2019/04/21 11:16

投稿

1090175
1090175

スコア6

test CHANGED
File without changes
test CHANGED
@@ -36,6 +36,12 @@
36
36
 
37
37
 
38
38
 
39
+ ※どのように情報を載せれば良いのかわからず、、ご指摘いただけますと幸いです。
40
+
41
+
42
+
43
+
44
+
39
45
 
40
46
 
41
47
  ### table