質問編集履歴

7

修正

2016/07/05 02:28

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -154,24 +154,6 @@
154
154
 
155
155
 
156
156
 
157
- var_dump($is_deletedn);
158
-
159
-
160
-
161
- bool(false)
162
-
163
-
164
-
165
- var_dump($is_deletedy);
166
-
167
-
168
-
169
- bool(true)
170
-
171
-
172
-
173
-
174
-
175
157
 
176
158
 
177
159
  ```

6

修正

2016/07/05 02:28

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -10,27 +10,25 @@
10
10
 
11
11
  $ct2 = 0;
12
12
 
13
- foreach ($ret as $h){
13
+ foreach ($ret as $h){
14
14
 
15
15
  $is_deleted[$ct2] = $h['is_deleted'];
16
16
 
17
17
  $ct2 += 1;
18
18
 
19
+ if(count($paraholiday) > 1 && array_search("y", $is_deleted) !== FALSE){
20
+
21
+ 登録処理
22
+
23
+ }else if(count($paraholiday) > 1 && array_search("n", $is_deleted) !== FALSE){
24
+
25
+ 削除処理
26
+
27
+ }
28
+
19
29
  }
20
30
 
21
- $is_deletedy = $h['is_deleted'] == 'y';
31
+
22
-
23
- $is_deletedn = $h['is_deleted'] == 'n';
24
-
25
- if(count($paraholiday)>1 && array_search($is_deletedn, $is_deleted) !== FALSE){
26
-
27
- 削除処理
28
-
29
- }else if(count($paraholiday)>1 && array_search($is_deletedy, $is_deleted) !== FALSE){
30
-
31
- 登録処理
32
-
33
- }
34
32
 
35
33
 
36
34
 

5

補足

2016/07/05 02:16

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -68,6 +68,58 @@
68
68
 
69
69
  ```
70
70
 
71
+
72
+
73
+ var_dump($h);
74
+
75
+ array(2) {
76
+
77
+ [0]=>
78
+
79
+ string(1) "y"
80
+
81
+ ["is_deleted"]=>
82
+
83
+ string(1) "y"
84
+
85
+ }
86
+
87
+
88
+
89
+ var_dump($ret);
90
+
91
+ array(2) {
92
+
93
+ [0]=>
94
+
95
+ array(2) {
96
+
97
+ [0]=>
98
+
99
+ string(1) "n"
100
+
101
+ ["is_deleted"]=>
102
+
103
+ string(1) "n"
104
+
105
+ }
106
+
107
+ [1]=>
108
+
109
+ array(2) {
110
+
111
+ [0]=>
112
+
113
+ string(1) "n"
114
+
115
+ ["is_deleted"]=>
116
+
117
+ string(1) "n"
118
+
119
+ }
120
+
121
+
122
+
71
123
  var_dump($paraholiday);
72
124
 
73
125
 

4

補足

2016/07/05 01:45

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,6 @@
1
- 下記コードで該当する日付(holiday)を「削除」か「登録」のif文に入れて「削除」か「登録」の処理を行いたいのですが行き詰まっております。
1
+ 下記コードで該当する日付(holiday)を「削除」か「登録」のif文に入れて「削除」か「登録」の処理を行いたいのですが行き詰まっております。複数の日付の登録はできますが、複数の日付の削除はできません。単体はどれもできます。
2
2
 
3
- どなたか教えて頂けますでしょうか。
3
+ たぶんif文に問題があると思いますが、う修正すればよいかどなたか教えて頂けますでしょうか。
4
4
 
5
5
 
6
6
 

3

修正

2016/07/05 01:33

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -24,11 +24,11 @@
24
24
 
25
25
  if(count($paraholiday)>1 && array_search($is_deletedn, $is_deleted) !== FALSE){
26
26
 
27
- $data['STR_tobe'] = "削除";
27
+ 削除処理
28
28
 
29
29
  }else if(count($paraholiday)>1 && array_search($is_deletedy, $is_deleted) !== FALSE){
30
30
 
31
- $data['STR_tobe'] = "登録";
31
+ 登録処理
32
32
 
33
33
  }
34
34
 

2

修正

2016/07/05 01:31

投稿

leoairen
leoairen

スコア122

test CHANGED
File without changes
test CHANGED
@@ -22,11 +22,11 @@
22
22
 
23
23
  $is_deletedn = $h['is_deleted'] == 'n';
24
24
 
25
- if(count($paraholiday)>1 && array_search($is_deletedn, $is_deleted)){
25
+ if(count($paraholiday)>1 && array_search($is_deletedn, $is_deleted) !== FALSE){
26
26
 
27
27
  $data['STR_tobe'] = "削除";
28
28
 
29
- }else if(count($paraholiday)>1 && array_search($is_deletedy, $is_deleted)){
29
+ }else if(count($paraholiday)>1 && array_search($is_deletedy, $is_deleted) !== FALSE){
30
30
 
31
31
  $data['STR_tobe'] = "登録";
32
32
 

1

修正

2016/07/05 01:29

投稿

leoairen
leoairen

スコア122

test CHANGED
@@ -1 +1 @@
1
- DBにある該当条件にしたがって処理をける
1
+ 条件に合致したカラムを抽出して処理をける
test CHANGED
File without changes