質問編集履歴

3

プログラム修正

2017/08/08 14:15

投稿

bigin
bigin

スコア67

test CHANGED
File without changes
test CHANGED
@@ -56,11 +56,11 @@
56
56
 
57
57
  データフラグ
58
58
 
59
- <select name="flag" required>
59
+ <select name="dataflag" required>
60
-
60
+
61
- <option value="1">1.ENTRY</option>
61
+ <option value="1">ENTRY</option>
62
-
62
+
63
- <option value="2">2.PICKUP情報</option>
63
+ <option value="2">PICKUP情報</option>
64
64
 
65
65
  </select>
66
66
 
@@ -144,15 +144,15 @@
144
144
 
145
145
  <input type="datetime-local" name="date1" value="2017-09-19T10:00">
146
146
 
147
- <input type="time" name="time" value="10:00">
147
+ <input type="time" name="date2" value="10:00">
148
148
 
149
149
  <br>
150
150
 
151
151
  日時 ②
152
152
 
153
- <input type="datetime-local" name="date2" value="2017-09-19T10:00">
153
+ <input type="datetime-local" name="date3" value="2017-09-19T10:00">
154
-
154
+
155
- <input type="time" name="time" value="10:00">
155
+ <input type="time" name="date4" value="10:00">
156
156
 
157
157
  </div>
158
158
 
@@ -206,7 +206,7 @@
206
206
 
207
207
  応募条件
208
208
 
209
- <input type="text" name="condition" class="form-control">
209
+ <input type="text" name="appcondition" class="form-control">
210
210
 
211
211
  </div>
212
212
 
@@ -262,6 +262,8 @@
262
262
 
263
263
  </html>
264
264
 
265
+
266
+
265
267
  ```
266
268
 
267
269
  **registration.php**
@@ -282,15 +284,19 @@
282
284
 
283
285
  <?php
284
286
 
287
+ echo "テスト";
288
+
285
289
  try{
286
290
 
287
291
  $db = new PDO('mysql:host=localhost;dbname=2017_t_autumn;charset=utf8','root','');
288
292
 
289
- $ftt=$db->prepare('INSERT INTO tokyo(item, flag, status,gazou,category,title,performer,performerurl,date1,date2,place,fee,fees,recruit,condition,deadline,announce,remark,attention,appurl)
290
-
291
- VALUES(:item,:flag,:status,:gazou,:category,:title,:performer,:performerurl,:date1,:date2,:place,:fee,:fees,:recruit,:condition,:deadline,:announce,:remark,:attention,:appurl)');
292
-
293
- $ftt->bindValue(':item',$_POST['title']);
293
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
294
+
295
+ $ftt=$db->prepare('INSERT INTO tokyo(item,flag,status,gazou,category,title,performer,performerurl,date1,date2,date3,date4,place,fee,fees,recruit,appcondition,deadline,announce,remark,attention,appurl)
296
+
297
+ VALUES(:item,:flag,:status,:gazou,:category,:title,:performer,:performerurl,:date1,:date2,:date3,:date4,:place,:fee,:fees,:recruit,:appcondition,:deadline,:announce,:remark,:attention,:appurl)');
298
+
299
+ $ftt->bindValue(':item',$_POST['item']);
294
300
 
295
301
  $ftt->bindValue(':flag',$_POST['flag']);
296
302
 
@@ -310,6 +316,10 @@
310
316
 
311
317
  $ftt->bindValue(':date2',$_POST['date2']);
312
318
 
319
+ $ftt->bindValue(':date3',$_POST['date3']);
320
+
321
+ $ftt->bindValue(':date4',$_POST['date4']);
322
+
313
323
  $ftt->bindValue(':place',$_POST['place']);
314
324
 
315
325
  $ftt->bindValue(':fee',$_POST['fee']);
@@ -318,7 +328,7 @@
318
328
 
319
329
  $ftt->bindValue(':recruit',$_POST['recruit']);
320
330
 
321
- $ftt->bindValue(':condition',$_POST['condition']);
331
+ $ftt->bindValue(':appcondition',$_POST['appcondition']);
322
332
 
323
333
  $ftt->bindValue(':deadline',$_POST['deadline']);
324
334
 
@@ -334,6 +344,8 @@
334
344
 
335
345
  $db = NULL;
336
346
 
347
+ echo "テスト";
348
+
337
349
  }catch(PDOException $e){
338
350
 
339
351
  die('エラーメッセージ:'.$e->getMessage());

2

DESCRIBE tokyoの結果

2017/08/08 14:15

投稿

bigin
bigin

スコア67

test CHANGED
File without changes
test CHANGED
@@ -376,4 +376,22 @@
376
376
 
377
377
  ```
378
378
 
379
- でも、flagに問題は見当たらないのですが、、、
379
+ でも、flagに問題は見当たらないのですが、、、なお,DESCRIBE tokyoの結果は以下の通りです。
380
+
381
+
382
+
383
+ ```ここに言語を入力
384
+
385
+ +-------+---------+------+-----+---------+-------+
386
+
387
+ | Field | Type | Null | Key | Default | Extra |
388
+
389
+ +-------+---------+------+-----+---------+-------+
390
+
391
+ | item | int(11) | YES | | NULL | |
392
+
393
+ +-------+---------+------+-----+---------+-------+
394
+
395
+ 1 row in set (0.00 sec)
396
+
397
+ ```

1

PDOのエラー処理コードを追加してやってみました。

2017/08/07 13:53

投稿

bigin
bigin

スコア67

test CHANGED
File without changes
test CHANGED
@@ -359,3 +359,21 @@
359
359
 
360
360
 
361
361
  よろしくお願いいたします。
362
+
363
+
364
+
365
+ 追記:
366
+
367
+ PDOのエラー処理コードを追加してやってみました。→PDO::ERRMODE_WARNING
368
+
369
+ すると、以下のエラーが出ました。
370
+
371
+
372
+
373
+ ```ここに言語を入力
374
+
375
+ Warning: PDOStatement::execute(): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'flag' in 'field list' in /home/ubuntu/workspace/bootstrap-3.3.7-dist/registration.php on line 33
376
+
377
+ ```
378
+
379
+ でも、flagに問題は見当たらないのですが、、、