回答編集履歴

7

変更

2015/12/04 20:35

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -24,11 +24,11 @@
24
24
 
25
25
  if(strpos($arr_pop,'FOREIGN KEY')){
26
26
 
27
- echo 'hit';
27
+ //外部キー制約がある場合の処理
28
28
 
29
29
  }else{
30
30
 
31
- echo 'none';
31
+ //ない場合の処理
32
32
 
33
33
  }
34
34
 
@@ -50,9 +50,9 @@
50
50
 
51
51
 
52
52
 
53
- $fk = new ForeignKey();
53
+ $fkey = new ForeignKey();
54
54
 
55
- $fk->getQuery();
55
+ $fkey->getQuery();
56
56
 
57
57
  function array_flatten($array){
58
58
 

6

変更

2015/12/04 20:35

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -18,15 +18,19 @@
18
18
 
19
19
  $result = array_flatten($result);
20
20
 
21
- if(!array_search('FOREIGN KEY',$result)){
21
+
22
22
 
23
+ $arr_pop = array_pop($result);
24
+
25
+ if(strpos($arr_pop,'FOREIGN KEY')){
26
+
23
- print 'None';
27
+ echo 'hit';
24
28
 
25
29
  }else{
26
30
 
27
- print 'Hit';
31
+ echo 'none';
28
32
 
29
- }
33
+ }
30
34
 
31
35
 
32
36
 
@@ -77,5 +81,3 @@
77
81
  ```
78
82
 
79
83
 
80
-
81
- ↑のコードだとたぶんヒットしませんが、foreachで回して、配列ごとにFOREIGNとかで検索かけるように修正すれば動くと思います。

5

追記

2015/12/04 20:33

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -75,3 +75,7 @@
75
75
 
76
76
 
77
77
  ```
78
+
79
+
80
+
81
+ ↑のコードだとたぶんヒットしませんが、foreachで回して、配列ごとにFOREIGNとかで検索かけるように修正すれば動くと思います。

4

追記

2015/12/04 20:21

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  $sql = $this->db->prepare("show create table tablename");
14
14
 
15
-
15
+ $sql->execute();
16
16
 
17
17
  $result = $sql->fetch(PDO::FETCH_ASSOC);
18
18
 

3

追記

2015/12/04 20:13

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  $sql = $this->db->prepare("show create table tablename");
14
14
 
15
- $sql->execute();
15
+
16
16
 
17
17
  $result = $sql->fetch(PDO::FETCH_ASSOC);
18
18
 

2

追記

2015/12/04 20:07

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -34,7 +34,9 @@
34
34
 
35
35
  catch(PDOException $e){
36
36
 
37
- $pdo->rollback();
37
+ print('Error:'.$e->getMessage());
38
+
39
+ die();
38
40
 
39
41
  }
40
42
 

1

追記

2015/12/04 19:56

投稿

tixure55
tixure55

スコア400

test CHANGED
@@ -28,9 +28,7 @@
28
28
 
29
29
  }
30
30
 
31
- $result_json = json_encode($result);
31
+
32
-
33
- //$json_pos = str
34
32
 
35
33
  }
36
34