teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

プログラム修正

2017/08/08 14:15

投稿

bigin
bigin

スコア67

title CHANGED
File without changes
body CHANGED
@@ -27,9 +27,9 @@
27
27
  </div>
28
28
  <div class="form-group">
29
29
  データフラグ
30
- <select name="flag" required>
30
+ <select name="dataflag" required>
31
- <option value="1">1.ENTRY</option>
31
+ <option value="1">ENTRY</option>
32
- <option value="2">2.PICKUP情報</option>
32
+ <option value="2">PICKUP情報</option>
33
33
  </select>
34
34
  </div>
35
35
  <div class="form-group">
@@ -71,11 +71,11 @@
71
71
  <div class="form-group">
72
72
  日時 ①
73
73
  <input type="datetime-local" name="date1" value="2017-09-19T10:00">
74
- <input type="time" name="time" value="10:00">
74
+ <input type="time" name="date2" value="10:00">
75
75
  <br>
76
76
  日時 ②
77
- <input type="datetime-local" name="date2" value="2017-09-19T10:00">
77
+ <input type="datetime-local" name="date3" value="2017-09-19T10:00">
78
- <input type="time" name="time" value="10:00">
78
+ <input type="time" name="date4" value="10:00">
79
79
  </div>
80
80
  <div class="form-group">
81
81
  場所
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
  <div class="form-group">
104
104
  応募条件
105
- <input type="text" name="condition" class="form-control">
105
+ <input type="text" name="appcondition" class="form-control">
106
106
  </div>
107
107
  <div class="form-group">
108
108
  応募締め切り
@@ -130,6 +130,7 @@
130
130
  </form>
131
131
  </body>
132
132
  </html>
133
+
133
134
  ```
134
135
  **registration.php**
135
136
  ```ここに言語を入力
@@ -140,11 +141,13 @@
140
141
  </head>
141
142
  <body>
142
143
  <?php
144
+ echo "テスト";
143
145
  try{
144
146
  $db = new PDO('mysql:host=localhost;dbname=2017_t_autumn;charset=utf8','root','');
145
- $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)
146
- VALUES(:item,:flag,:status,:gazou,:category,:title,:performer,:performerurl,:date1,:date2,:place,:fee,:fees,:recruit,:condition,:deadline,:announce,:remark,:attention,:appurl)');
147
- $ftt->bindValue(':item',$_POST['title']);
147
+ $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
148
+ $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)
149
+ VALUES(:item,:flag,:status,:gazou,:category,:title,:performer,:performerurl,:date1,:date2,:date3,:date4,:place,:fee,:fees,:recruit,:appcondition,:deadline,:announce,:remark,:attention,:appurl)');
150
+ $ftt->bindValue(':item',$_POST['item']);
148
151
  $ftt->bindValue(':flag',$_POST['flag']);
149
152
  $ftt->bindValue(':status',$_POST['status']);
150
153
  $ftt->bindValue(':gazou',$_POST['gazou']);
@@ -154,11 +157,13 @@
154
157
  $ftt->bindValue(':performerurl',$_POST['performerurl']);
155
158
  $ftt->bindValue(':date1',$_POST['date1']);
156
159
  $ftt->bindValue(':date2',$_POST['date2']);
160
+ $ftt->bindValue(':date3',$_POST['date3']);
161
+ $ftt->bindValue(':date4',$_POST['date4']);
157
162
  $ftt->bindValue(':place',$_POST['place']);
158
163
  $ftt->bindValue(':fee',$_POST['fee']);
159
164
  $ftt->bindValue(':fees',$_POST['fees']);
160
165
  $ftt->bindValue(':recruit',$_POST['recruit']);
161
- $ftt->bindValue(':condition',$_POST['condition']);
166
+ $ftt->bindValue(':appcondition',$_POST['appcondition']);
162
167
  $ftt->bindValue(':deadline',$_POST['deadline']);
163
168
  $ftt->bindValue(':announce',$_POST['announce']);
164
169
  $ftt->bindValue(':remark',$_POST['remark']);
@@ -166,6 +171,7 @@
166
171
  $ftt->bindValue(':appurl',$_POST['appurl']);
167
172
  $ftt->execute();
168
173
  $db = NULL;
174
+ echo "テスト";
169
175
  }catch(PDOException $e){
170
176
  die('エラーメッセージ:'.$e->getMessage());
171
177
  }

2

DESCRIBE tokyoの結果

2017/08/08 14:15

投稿

bigin
bigin

スコア67

title CHANGED
File without changes
body CHANGED
@@ -187,4 +187,13 @@
187
187
  ```ここに言語を入力
188
188
  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
189
189
  ```
190
- でも、flagに問題は見当たらないのですが、、、
190
+ でも、flagに問題は見当たらないのですが、、、なお,DESCRIBE tokyoの結果は以下の通りです。
191
+
192
+ ```ここに言語を入力
193
+ +-------+---------+------+-----+---------+-------+
194
+ | Field | Type | Null | Key | Default | Extra |
195
+ +-------+---------+------+-----+---------+-------+
196
+ | item | int(11) | YES | | NULL | |
197
+ +-------+---------+------+-----+---------+-------+
198
+ 1 row in set (0.00 sec)
199
+ ```

1

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

2017/08/07 13:53

投稿

bigin
bigin

スコア67

title CHANGED
File without changes
body CHANGED
@@ -178,4 +178,13 @@
178
178
  なお、フォーム送信後は「登録が完了しました。」のみ表示されます。
179
179
  なので、データベースには接続していると思うのですが、、、
180
180
 
181
- よろしくお願いいたします。
181
+ よろしくお願いいたします。
182
+
183
+ 追記:
184
+ PDOのエラー処理コードを追加してやってみました。→PDO::ERRMODE_WARNING
185
+ すると、以下のエラーが出ました。
186
+
187
+ ```ここに言語を入力
188
+ 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
189
+ ```
190
+ でも、flagに問題は見当たらないのですが、、、