質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,4 +92,58 @@
|
|
92
92
|
|
93
93
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
94
94
|
|
95
|
+
create table Course (
|
96
|
+
|
97
|
+
Course_Number int(5) auto_increment,
|
98
|
+
|
99
|
+
Course_Name varchar(30) not null,
|
100
|
+
|
101
|
+
Release_Range boolean not null,
|
102
|
+
|
103
|
+
Maintenance date not null,
|
104
|
+
|
105
|
+
primary key(Course_Number));
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
insert into Course(Course_Name,Release_Range,Maintenance) values('グルーミング',true,'20171112');
|
110
|
+
|
111
|
+
insert into Course(Course_Name,Release_Range,Maintenance) values('トリミング',true,'20171112');
|
112
|
+
|
113
|
+
insert into Course(Course_Name,Release_Range,Maintenance) values('シャンプー',true,'20171112');
|
114
|
+
|
115
|
+
-----------------------------------------------------------------------
|
116
|
+
|
95
|
-
|
117
|
+
create table Size (
|
118
|
+
|
119
|
+
Size_Number int(5) auto_increment,
|
120
|
+
|
121
|
+
Size_name varchar(20) not null,
|
122
|
+
|
123
|
+
Release_Range boolean not null,
|
124
|
+
|
125
|
+
Maintenance date not null,
|
126
|
+
|
127
|
+
primary key(Size_Number)
|
128
|
+
|
129
|
+
);
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('小型',true,20171112,'グルーミング');
|
134
|
+
|
135
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('中型',true,20171112,'グルーミング');
|
136
|
+
|
137
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('大型',true,20171112,'グルーミング');
|
138
|
+
|
139
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('小型',true,20171112,'トリミング');
|
140
|
+
|
141
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('中型',true,20171112,'トリミング');
|
142
|
+
|
143
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('大型',true,20171112,'トリミング');
|
144
|
+
|
145
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('小型',true,20171112,'シャンプー');
|
146
|
+
|
147
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('中型',true,20171112,'シャンプー');
|
148
|
+
|
149
|
+
insert into Size(Size_name,Release_Range,Maintenance,Course_name) values('大型',true,20171112,'シャンプー');
|
2
エラー修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,15 +14,11 @@
|
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
|
17
|
+
Notice: Undefined variable: key1 in C:\xampp\htdocs\training\aaa\index.php on line 19
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
|
21
|
+
Fatal error: Call to a member function prepare() on null in C:\xampp\htdocs\training\aaa\index.php on line 19
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\training\aaa\index.php on line 26
|
26
22
|
|
27
23
|
```
|
28
24
|
|
1
ソースコード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
$col_math=0;
|
42
42
|
|
43
|
-
|
43
|
+
$pdo = new PDO("mysql:host=localhost;dbname=doubutsu;charset=utf8",'root','admin');
|
44
44
|
|
45
45
|
|
46
46
|
|
@@ -48,9 +48,9 @@
|
|
48
48
|
|
49
49
|
try{
|
50
50
|
|
51
|
-
$pdo
|
51
|
+
$stmt = $pdo -> prepare("SELECT course_name from Course");
|
52
52
|
|
53
|
-
$stmt
|
53
|
+
$stmt->execute();
|
54
54
|
|
55
55
|
foreach($stmt as $key) {
|
56
56
|
|
@@ -60,23 +60,13 @@
|
|
60
60
|
|
61
61
|
}
|
62
62
|
|
63
|
-
|
63
|
+
echo $course_name_array[2];
|
64
64
|
|
65
|
-
|
65
|
+
foreach ($course_name_array as $key1 ) {
|
66
66
|
|
67
|
-
|
67
|
+
$stmt = $pdo -> prepare("SELECT Size from Size where course_name='".$key1."'");
|
68
68
|
|
69
|
-
}
|
70
|
-
|
71
|
-
ec
|
69
|
+
$stmt->execute();
|
72
|
-
|
73
|
-
foreach ($course_name_array as $key1) {
|
74
|
-
|
75
|
-
try{
|
76
|
-
|
77
|
-
$pdo = new PDO("mysql:host=localhost;dbname=doubutsu;charset=utf8",'root','admin');
|
78
|
-
|
79
|
-
$stmt = $pdo -> query("SELECT Size from Size where course_name='".$key1."'");
|
80
70
|
|
81
71
|
foreach ($stmt as $key2) {
|
82
72
|
|
@@ -86,13 +76,13 @@
|
|
86
76
|
|
87
77
|
$pdo = null;
|
88
78
|
|
89
|
-
}
|
79
|
+
}
|
90
80
|
|
91
|
-
|
81
|
+
}catch(PDOException $e){
|
92
82
|
|
93
|
-
|
83
|
+
exit('データベース接続失敗' . $e->getMessage());
|
94
84
|
|
95
|
-
}
|
85
|
+
}
|
96
86
|
|
97
87
|
```
|
98
88
|
|