質問編集履歴
2
ロリポップサーバーで実行し、そこで出たエラーメッセージがローカルサーバーと異なったため追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -139,12 +139,59 @@
|
|
139
139
|
}
|
140
140
|
}
|
141
141
|
```
|
142
|
+
```
|
143
|
+
donedoneただいま障害により大変ご迷惑をおかけしております。
|
144
|
+
object(PDOException)#3 (8) {
|
145
|
+
["message":protected]=>
|
146
|
+
string(81) "SQLSTATE[42S22]: Column not found: 1054 Unknown column '$contact' in 'field list'"
|
147
|
+
["string":"Exception":private]=>
|
148
|
+
string(0) ""
|
149
|
+
["code":protected]=>
|
150
|
+
string(5) "42S22"
|
151
|
+
["file":protected]=>
|
152
|
+
string(53) "*******************************"
|
153
|
+
["line":protected]=>
|
154
|
+
int(49)
|
155
|
+
["trace":"Exception":private]=>
|
156
|
+
array(1) {
|
157
|
+
[0]=>
|
158
|
+
array(6) {
|
159
|
+
["file"]=>
|
160
|
+
string(53) "**************************"
|
161
|
+
["line"]=>
|
162
|
+
int(49)
|
163
|
+
["function"]=>
|
164
|
+
string(5) "query"
|
165
|
+
["class"]=>
|
166
|
+
string(3) "PDO"
|
167
|
+
["type"]=>
|
168
|
+
string(2) "->"
|
169
|
+
["args"]=>
|
170
|
+
array(1) {
|
171
|
+
[0]=>
|
172
|
+
string(220) "INSERT INTO `LA****************`.`***************`(`id`, `お問い合わせ内容`, `氏名`, `メールアドレス`, `電話番号`, `メッセージ`, `created_at`)VALUES(NULL,$contact,$name,$email,$tel,$message,NULL)"
|
173
|
+
}
|
174
|
+
}
|
175
|
+
}
|
176
|
+
["previous":"Exception":private]=>
|
177
|
+
NULL
|
178
|
+
["errorInfo"]=>
|
179
|
+
array(3) {
|
180
|
+
[0]=>
|
181
|
+
string(5) "42S22"
|
182
|
+
[1]=>
|
183
|
+
int(1054)
|
184
|
+
[2]=>
|
185
|
+
string(41) "Unknown column '$contact' in 'field list'"
|
186
|
+
}
|
187
|
+
}
|
188
|
+
```
|
142
189
|
|
143
190
|
index.phpのフォームからaction="POST", method="confirm.phpで上記のコードファイルに移り、MySQLにデータが保存されるようにしたいのですが、catchの処理が行われてしまいます。
|
144
191
|
|
145
|
-
|
192
|
+
AbeTakashiさんにご指摘いただいたように、var_dump($e);にてエラーメッセージを表示させることができました。
|
193
|
+
AbeTakashiさんにご指摘いただいたように、ローカルサーバーでの実行ではなくロリポップサーバーで実行したところ、?,?,?,?,?,NULL)の部分に文法ミスがあるとエラーメッセージが出たため、?の部分を$contactなどで代用しました。その結果、上記のエラーメッセージになりました。
|
146
194
|
|
147
|
-
|
148
195
|
### ソースコード全体
|
149
196
|
<?php
|
150
197
|
|
1
エラーメッセージを追記しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -46,9 +46,103 @@
|
|
46
46
|
}
|
47
47
|
```
|
48
48
|
|
49
|
+
### エラーメッセージ
|
50
|
+
```
|
51
|
+
object(PDOException)#3 (8) {
|
52
|
+
["message":protected]=>
|
53
|
+
string(113) "SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
|
54
|
+
["string":"Exception":private]=>
|
55
|
+
string(0) ""
|
56
|
+
["code":protected]=>
|
57
|
+
int(2002)
|
58
|
+
["file":protected]=>
|
59
|
+
string(64) "/Applications/MAMP/htdocs/********/public/confirm.php"
|
60
|
+
["line":protected]=>
|
61
|
+
int(44)
|
62
|
+
["trace":"Exception":private]=>
|
63
|
+
array(1) {
|
64
|
+
[0]=>
|
65
|
+
array(6) {
|
66
|
+
["file"]=>
|
67
|
+
string(64) "/Applications/MAMP/htdocs/**********/public/confirm.php"
|
68
|
+
["line"]=>
|
69
|
+
int(44)
|
70
|
+
["function"]=>
|
71
|
+
string(11) "__construct"
|
72
|
+
["class"]=>
|
73
|
+
string(3) "PDO"
|
74
|
+
["type"]=>
|
75
|
+
string(2) "->"
|
76
|
+
["args"]=>
|
77
|
+
array(3) {
|
78
|
+
[0]=>
|
79
|
+
string(61) "mysql:host=mysql*****************;dbname=LA************"
|
80
|
+
[1]=>
|
81
|
+
string(24) "LA**********"
|
82
|
+
[2]=>
|
83
|
+
string(12) "************"
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
["previous":"Exception":private]=>
|
88
|
+
object(PDOException)#2 (9) {
|
89
|
+
["message":protected]=>
|
90
|
+
string(110) "PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
|
91
|
+
["string":"Exception":private]=>
|
92
|
+
string(0) ""
|
93
|
+
["code":protected]=>
|
94
|
+
int(0)
|
95
|
+
["file":protected]=>
|
96
|
+
string(64) "/Applications/MAMP/htdocs/********/public/confirm.php"
|
97
|
+
["line":protected]=>
|
98
|
+
int(44)
|
99
|
+
["trace":"Exception":private]=>
|
100
|
+
array(1) {
|
101
|
+
[0]=>
|
102
|
+
array(6) {
|
103
|
+
["file"]=>
|
104
|
+
string(64) "/Applications/MAMP/htdocs/**********/public/confirm.php"
|
105
|
+
["line"]=>
|
106
|
+
int(44)
|
107
|
+
["function"]=>
|
108
|
+
string(11) "__construct"
|
109
|
+
["class"]=>
|
110
|
+
string(3) "PDO"
|
111
|
+
["type"]=>
|
112
|
+
string(2) "->"
|
113
|
+
["args"]=>
|
114
|
+
array(3) {
|
115
|
+
[0]=>
|
116
|
+
string(61) "mysql:host=mysql***************;dbname=LA*************"
|
117
|
+
[1]=>
|
118
|
+
string(24) "LA*************"
|
119
|
+
[2]=>
|
120
|
+
string(12) "***************"
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
["previous":"Exception":private]=>
|
125
|
+
NULL
|
126
|
+
["errorInfo"]=>
|
127
|
+
NULL
|
128
|
+
["severity"]=>
|
129
|
+
int(2)
|
130
|
+
}
|
131
|
+
["errorInfo"]=>
|
132
|
+
array(3) {
|
133
|
+
[0]=>
|
134
|
+
string(5) "HY000"
|
135
|
+
[1]=>
|
136
|
+
int(2002)
|
137
|
+
[2]=>
|
138
|
+
string(90) "php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
|
139
|
+
}
|
140
|
+
}
|
141
|
+
```
|
142
|
+
|
49
143
|
index.phpのフォームからaction="POST", method="confirm.phpで上記のコードファイルに移り、MySQLにデータが保存されるようにしたいのですが、catchの処理が行われてしまいます。
|
50
144
|
|
51
|
-
|
145
|
+
AbeTalashiさんにご指摘いただいたように、var_dump($e);にてエラーメッセージを表示させることができました。
|
52
146
|
|
53
147
|
|
54
148
|
### ソースコード全体
|