質問編集履歴
3
「```<?」では<?が表示消えてしまうため、間に改行追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,7 +64,11 @@
|
|
64
64
|
|
65
65
|
こういうこと?と書いてみた失敗コード
|
66
66
|
|
67
|
+
```
|
68
|
+
|
67
|
-
|
69
|
+
<?
|
70
|
+
|
71
|
+
|
68
72
|
|
69
73
|
php foreach ($a_data as $row) {
|
70
74
|
|
2
ご指摘ありがとうございました。コードを自分なりに見やすくなるよう記載しなおしてみました。よろしくお願いいします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,27 +26,25 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
$view_data['a_data'] = (DB接続)->select_all('category', array('parent_category_code' => $category_a_code, 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
30
29
|
|
31
30
|
|
31
|
+
```
|
32
|
+
|
33
|
+
$view_data['a_data'] = (DB接続)->select_all('category', array('parent_category_code' => $category_a_code, 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
32
34
|
|
33
35
|
foreach($view_data['a_data'] as $k => &$category_b) {
|
34
36
|
|
37
|
+
$category_b['category_c'] = (DB接続) ->select_all('category', array('parent_category_code' => $category_b['category_code'], 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
35
38
|
|
39
|
+
foreach($category_b['category_c'] as $k => &$category_c) {
|
36
40
|
|
37
|
-
$
|
41
|
+
$help = (DB接続) ->select_all('help', array('category_c' => $category_c['category_code'], 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
38
42
|
|
39
|
-
|
43
|
+
$category_c['help'] = empty($help) ? array() : $help;
|
40
44
|
|
45
|
+
}
|
41
46
|
|
42
|
-
|
43
|
-
$help = (DB接続) ->select_all('help', array('category_c' => $category_c['category_code'], 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
44
|
-
|
45
|
-
$category_c['help'] = empty($help) ? array() : $help;
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
unset($category_c);
|
47
|
+
unset($category_c);
|
50
48
|
|
51
49
|
}
|
52
50
|
|
@@ -56,15 +54,17 @@
|
|
56
54
|
|
57
55
|
return $view_data;
|
58
56
|
|
57
|
+
|
58
|
+
|
59
|
-
|
59
|
+
```
|
60
|
+
|
61
|
+
|
60
62
|
|
61
63
|
### index.phpファイル
|
62
64
|
|
63
65
|
こういうこと?と書いてみた失敗コード
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
<?
|
67
|
+
```<?
|
68
68
|
|
69
69
|
php foreach ($a_data as $row) {
|
70
70
|
|
@@ -79,3 +79,5 @@
|
|
79
79
|
|
80
80
|
|
81
81
|
?>
|
82
|
+
|
83
|
+
```
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,29 +28,35 @@
|
|
28
28
|
|
29
29
|
$view_data['a_data'] = (DB接続)->select_all('category', array('parent_category_code' => $category_a_code, 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
30
30
|
|
31
|
-
foreach($view_data['a_data'] as $k => &$category_b) {
|
32
31
|
|
32
|
+
|
33
|
+
foreach($view_data['a_data'] as $k => &$category_b) {
|
34
|
+
|
35
|
+
|
36
|
+
|
33
|
-
|
37
|
+
$category_b['category_c'] = (DB接続) ->select_all('category', array('parent_category_code' => $category_b['category_code'], 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
34
38
|
|
35
39
|
foreach($category_b['category_c'] as $k => &$category_c) {
|
36
40
|
|
41
|
+
|
42
|
+
|
37
|
-
|
43
|
+
$help = (DB接続) ->select_all('help', array('category_c' => $category_c['category_code'], 'delete_flg' => FLG_FALSE), array('disp_order' => 'ASC'));
|
38
44
|
|
39
45
|
$category_c['help'] = empty($help) ? array() : $help;
|
40
46
|
|
41
|
-
|
47
|
+
}
|
42
48
|
|
43
|
-
|
49
|
+
unset($category_c);
|
44
50
|
|
45
|
-
|
51
|
+
}
|
46
52
|
|
47
|
-
|
53
|
+
unset($category_b);
|
48
54
|
|
49
55
|
|
50
56
|
|
51
|
-
|
57
|
+
return $view_data;
|
52
58
|
|
53
|
-
|
59
|
+
}
|
54
60
|
|
55
61
|
### index.phpファイル
|
56
62
|
|
@@ -58,10 +64,18 @@
|
|
58
64
|
|
59
65
|
|
60
66
|
|
61
|
-
<?
|
67
|
+
<?
|
62
68
|
|
63
|
-
|
69
|
+
php foreach ($a_data as $row) {
|
64
70
|
|
65
|
-
<?php echo $row['category_b']; ?>
|
66
71
|
|
72
|
+
|
73
|
+
php echo $row['a_data'];
|
74
|
+
|
75
|
+
php echo $row['category_b'];
|
76
|
+
|
67
|
-
|
77
|
+
php echo $row['category_c'];
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
?>
|