質問編集履歴
4
改善
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
3
改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
```
|
5
5
|
<?php
|
6
6
|
if(filter_input(INPUT_POST,'btn')==='register')
|
7
|
-
$sql = 'INSERT INTO
|
7
|
+
$sql = 'INSERT INTO XXX ("name", "comment") VALUES (NULL, "名前")(NULL, "内容")';
|
8
8
|
$sth = $dbh->prepare($sql);
|
9
9
|
$sth->bindparam(':name', $_POST['name'], PDO::PARAM_STR);
|
10
10
|
$sth->bindparam(':comment', $_POST['comment'], PDO::PARAM_STR);
|
2
改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
掲示板を作成してるんですが、以下のコードで何か足りないものとかありますか
|
2
|
-
ブラウザに出しても
|
2
|
+
ブラウザに出してもエラーが表示され、何が間違いなのか分かりません
|
3
3
|
|
4
4
|
```
|
5
5
|
<?php
|
6
6
|
if(filter_input(INPUT_POST,'btn')==='register')
|
7
|
-
$sql = 'INSERT INTO kadai1 ("name", "comment") VALUES (NULL, "名前")(NULL, "内容");
|
7
|
+
$sql = 'INSERT INTO kadai1 ("name", "comment") VALUES (NULL, "名前")(NULL, "内容")';
|
8
8
|
$sth = $dbh->prepare($sql);
|
9
9
|
$sth->bindparam(':name', $_POST['name'], PDO::PARAM_STR);
|
10
10
|
$sth->bindparam(':comment', $_POST['comment'], PDO::PARAM_STR);
|
1
改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
掲示板を作成してるんですが、以下のコードで何か足りないものとかありますか
|
2
|
-
ブラウザに出してもParse error: syntax error, unexpected ':' in C:\XAMPP\htdocs\
|
2
|
+
ブラウザに出してもParse error: syntax error, unexpected ':' in C:\XAMPP\htdocs\XXX.php on line 5と出ていて5行目を指してるのは分かるけど何が間違いなのか分かりません
|
3
3
|
|
4
4
|
```
|
5
5
|
<?php
|
@@ -22,9 +22,9 @@
|
|
22
22
|
}
|
23
23
|
|
24
24
|
function dbAccess(){
|
25
|
-
$dsn = 'mysql:dbname=
|
25
|
+
$dsn = 'mysql:dbname=XXX;host=localhost;charset=utf8mb4';
|
26
|
-
$user = '
|
26
|
+
$user = 'XXX';
|
27
|
-
$password = '
|
27
|
+
$password = 'XXX';
|
28
28
|
|
29
29
|
try {
|
30
30
|
|