回答編集履歴
2
構文エラーに気づかず。。
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
) VALUES
|
8
8
|
|
9
|
-
('$ans[0]',
|
9
|
+
('$ans[0]', $ans[1], '$ans[2]', '$ans[3]', '$ans[4]', '$ans[5]', '$ans[6]', '$ans[7]', '$ans[8]', '$ans[9]')";
|
10
10
|
|
11
11
|
```
|
12
12
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
$sql = "INSERT INTO sample2 (name, old, sex, birthday, address, hobby, birthplace, job, favfood, favmovie) VALUES "
|
24
24
|
|
25
|
-
. "(:
|
25
|
+
. "(:name, :old, :sex, :birthday, :address, :hobby, :birthplace, :job, :favfood, :favmovie)";
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -30,11 +30,9 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
$stmt->bindParam(':
|
33
|
+
$stmt->bindParam(':name', $ans[0], PDO::PARAM_STR);
|
34
34
|
|
35
|
-
$stmt->bindParam(':lastname', $ans[1], PDO::PARAM_STR);
|
36
|
-
|
37
|
-
$stmt->bindValue(':old', $ans[
|
35
|
+
$stmt->bindValue(':old', $ans[1], PDO::PARAM_INT);
|
38
36
|
|
39
37
|
.
|
40
38
|
|
1
文法修正
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
$stmt->bindParam(':firstname', $ans[0], PDO::PARAM_STR);
|
34
34
|
|
35
|
-
$stmt->bind
|
35
|
+
$stmt->bindParam(':lastname', $ans[1], PDO::PARAM_STR);
|
36
36
|
|
37
37
|
$stmt->bindValue(':old', $ans[2], PDO::PARAM_INT);
|
38
38
|
|