質問編集履歴
2
コード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
```ここに言語を入力
|
2
|
+
|
3
|
+
コード
|
4
|
+
|
1
|
-
SQLの実行結果を配列に格納しています
|
5
|
+
```SQLの実行結果を配列に格納しています
|
2
6
|
|
3
7
|
```PHP
|
4
8
|
|
@@ -55,3 +59,271 @@
|
|
55
59
|
$MachineToolData=array(array('id'=>$result['id'],'pkno'=>$result['pkno'],'tno'=>$result['tno'],'gno'=>$result['gno'],'name'=>$result['name']));
|
56
60
|
|
57
61
|
$Cnt++; }
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
追記 詳細なコード追記します
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
```PHP
|
72
|
+
|
73
|
+
配列作成側(SQL実行側)
|
74
|
+
|
75
|
+
public function GetMachineToolData(string $MysqlToolDataTableName): array{
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
$MachineToolData;
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
try{
|
84
|
+
|
85
|
+
$pdo = new PDO(self::DSN,self::USER,self::PASSWORD);
|
86
|
+
|
87
|
+
}catch(PDOException $e){
|
88
|
+
|
89
|
+
echo "MySQL接続エラー: " .$e->getMessage();
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
$stmt = $pdo->query('select '.$MysqlToolDataTableName . '.id,pkno,tno,gno,tool_name.name,nom,tool_suf.suf_name,sufatr,
|
96
|
+
|
97
|
+
lengthA,diameter,lifetime,usetime,lifenumber,usenumber,tool_itf.itf,taprfeed,taptype,thrust,horsepower
|
98
|
+
|
99
|
+
from '.$MysqlToolDataTableName .',tool_name,tool_suf,tool_itf
|
100
|
+
|
101
|
+
where ' .$MysqlToolDataTableName .'.name=tool_name.t_id
|
102
|
+
|
103
|
+
and ' .$MysqlToolDataTableName .'.suf=tool_suf.suf_id
|
104
|
+
|
105
|
+
and '.$MysqlToolDataTableName . '.itf=tool_itf.itf_id
|
106
|
+
|
107
|
+
order by id desc');
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
$Cnt=0;
|
112
|
+
|
113
|
+
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
$MachineToolData[$Cnt]=array( $result['id'],$result['pkno'],$result['tno'],$result['gno'],$result['name'],$result['nom'],$result['suf_name'],
|
118
|
+
|
119
|
+
$result['sufatr'],$result['lengthA'],$result['diameter'],$result['lifetime'],$result['usetime'],
|
120
|
+
|
121
|
+
$result['lifenumber'],$result['usenumber'],$result['itf'],$result['taprfeed'],$result['taptype'],
|
122
|
+
|
123
|
+
$result['thrust'],$result['horsepower']);
|
124
|
+
|
125
|
+
$Cnt++;
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
return $MachineToolData;
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
呼び出し側
|
140
|
+
|
141
|
+
$MachineToolData=$objDB->GetMachineToolData(MYSQL_TOOLDATA_TABLE_NAME);
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
function SetTableData($MachineToolData){
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
$Cnt=0;
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
while (empty($MachineToolData[$Cnt][2]) <> True) {
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
echo "<tr>";
|
158
|
+
|
159
|
+
echo "<td>";
|
160
|
+
|
161
|
+
echo $MachineToolData[$Cnt][0];
|
162
|
+
|
163
|
+
echo "</td>";
|
164
|
+
|
165
|
+
echo "<td>";
|
166
|
+
|
167
|
+
echo $MachineToolData[$Cnt][1];
|
168
|
+
|
169
|
+
echo "</td>";
|
170
|
+
|
171
|
+
echo "<td>";
|
172
|
+
|
173
|
+
echo $MachineToolData[$Cnt][2];
|
174
|
+
|
175
|
+
echo "</td>";
|
176
|
+
|
177
|
+
echo "<td>";
|
178
|
+
|
179
|
+
echo $MachineToolData[$Cnt][3];
|
180
|
+
|
181
|
+
echo "</td>";
|
182
|
+
|
183
|
+
echo "<td>";
|
184
|
+
|
185
|
+
echo $MachineToolData[$Cnt][4];
|
186
|
+
|
187
|
+
echo "</td>";
|
188
|
+
|
189
|
+
echo "<td>";
|
190
|
+
|
191
|
+
echo $MachineToolData[$Cnt][5];
|
192
|
+
|
193
|
+
echo "</td>";
|
194
|
+
|
195
|
+
echo "<td>";
|
196
|
+
|
197
|
+
echo $MachineToolData[$Cnt][6];
|
198
|
+
|
199
|
+
echo "</td>";
|
200
|
+
|
201
|
+
echo "<td>";
|
202
|
+
|
203
|
+
if($MachineToolData[$Cnt][7]==0){
|
204
|
+
|
205
|
+
echo "" . ' ';
|
206
|
+
|
207
|
+
}else{
|
208
|
+
|
209
|
+
echo "重量" . ' ';
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
echo "</td>";
|
214
|
+
|
215
|
+
echo "<td>";
|
216
|
+
|
217
|
+
if($this->mathine_name=="VORTEX"or"FJV250"or"HCN"or"HCN5000"or"HCN68001_1"or"HCN68001_2"){
|
218
|
+
|
219
|
+
echo $MachineToolData[$Cnt][8]/10000 . ' ';
|
220
|
+
|
221
|
+
}else{
|
222
|
+
|
223
|
+
echo $MachineToolData[$Cnt][8]/1000 . ' ';
|
224
|
+
|
225
|
+
}
|
226
|
+
|
227
|
+
echo "</td>";
|
228
|
+
|
229
|
+
echo "<td>";
|
230
|
+
|
231
|
+
if($this->mathine_name=="VORTEX"or"FJV250"or"HCN"or"HCN5000"or"HCN68001_1"or"HCN68001_2"){
|
232
|
+
|
233
|
+
echo $MachineToolData[$Cnt][9]/10000 . ' ';
|
234
|
+
|
235
|
+
}else{
|
236
|
+
|
237
|
+
echo $MachineToolData[$Cnt][8]/1000 . ' ';
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
echo "</td>";
|
242
|
+
|
243
|
+
echo "<td>";
|
244
|
+
|
245
|
+
echo round($MachineToolData[$Cnt][9]/60) . ' ';
|
246
|
+
|
247
|
+
echo "</td>";
|
248
|
+
|
249
|
+
echo "<td>";
|
250
|
+
|
251
|
+
echo round($MachineToolData[$Cnt][10]/60) . ' ';
|
252
|
+
|
253
|
+
echo "</td>";
|
254
|
+
|
255
|
+
echo "<td>";
|
256
|
+
|
257
|
+
echo $MachineToolData[$Cnt][11] . ' ';
|
258
|
+
|
259
|
+
echo "</td>";
|
260
|
+
|
261
|
+
echo "<td>";
|
262
|
+
|
263
|
+
echo $MachineToolData[$Cnt][12] . ' ';
|
264
|
+
|
265
|
+
echo "</td>";
|
266
|
+
|
267
|
+
echo "<td>";
|
268
|
+
|
269
|
+
echo $MachineToolData[$Cnt][13] . ' ';
|
270
|
+
|
271
|
+
echo "</td>";
|
272
|
+
|
273
|
+
echo "<td>";
|
274
|
+
|
275
|
+
echo $MachineToolData[$Cnt][14] . ' ';
|
276
|
+
|
277
|
+
echo "</td>";
|
278
|
+
|
279
|
+
echo "<td>";
|
280
|
+
|
281
|
+
if($MachineToolData[$Cnt][15]==0){
|
282
|
+
|
283
|
+
echo "" . ' ';
|
284
|
+
|
285
|
+
}else{
|
286
|
+
|
287
|
+
echo "同期" . ' ';
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
echo "</td>";
|
292
|
+
|
293
|
+
echo "<td>";
|
294
|
+
|
295
|
+
echo $MachineToolData[$Cnt][16] . ' ';
|
296
|
+
|
297
|
+
echo "</td>";
|
298
|
+
|
299
|
+
echo "<td>";
|
300
|
+
|
301
|
+
echo $MachineToolData[$Cnt][17] . ' ';
|
302
|
+
|
303
|
+
echo "</td>";
|
304
|
+
|
305
|
+
echo "</tr>";
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
$Cnt++;
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
echo "</TABLE>";
|
316
|
+
|
317
|
+
echo "</body>";
|
318
|
+
|
319
|
+
echo "</html>";
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
```
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
現在コーディングしている
|
7
|
+
現在コーディングしている配列
|
8
8
|
|
9
9
|
while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
10
10
|
|