質問編集履歴
1
ソースコードを記入しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,95 @@
|
|
1
|
-
Wordpressでショートコードを使ってPHPファイルを呼び出
|
1
|
+
Wordpressでショートコードを使ってPHPファイルを呼び出す。
|
2
|
+
|
3
|
+
複数件のデータを使用しています。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
今使っているショートコード
|
8
|
+
|
9
|
+
[myphp1 file='foo']
|
10
|
+
|
11
|
+
|
2
12
|
|
3
13
|
しかし、特定の列のみを呼び出すショートコードが分からず状態です。
|
4
14
|
|
5
15
|
分かる方教えてください。
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
//foo.phpのソースコード
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
<?php
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
$sql = "SELECT * from kitaqua_office";
|
28
|
+
|
29
|
+
$stmt = $pdo -> prepare($sql);
|
30
|
+
|
31
|
+
$stmt -> execute(null);
|
32
|
+
|
33
|
+
$res = "";
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
print "<table border='1'>\n";
|
38
|
+
|
39
|
+
/*
|
40
|
+
|
41
|
+
while($row = $stmt ->fetch(PDO::FETCH_ASSOC)){
|
42
|
+
|
43
|
+
$res .= $row{'corporation_number'} . "," . $row{'corporation‗name'} ."<br>\n";
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
while($row = $stmt ->fetch(PDO::FETCH_ASSOC)){
|
52
|
+
|
53
|
+
$A = $row{'establishment_name'};
|
54
|
+
|
55
|
+
$B = $row{'establishment_location'};
|
56
|
+
|
57
|
+
$C = $row{'tel'};
|
58
|
+
|
59
|
+
$D = $row{'work'};
|
60
|
+
|
61
|
+
$E = $row{'address'};
|
62
|
+
|
63
|
+
$F = $row{'homepage_url'};
|
64
|
+
|
65
|
+
$G = $row{'max_persons'};
|
66
|
+
|
67
|
+
$res .= $A . $B . $C . $D ."<br>\n";
|
68
|
+
|
69
|
+
$res .= $E . $F . $G . "<br>\n";
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
*/
|
74
|
+
|
75
|
+
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
|
76
|
+
|
77
|
+
$res .= "\t<tr>\n";
|
78
|
+
|
79
|
+
$res .= "\t\t<td>{$row['establishment_name']}</td>";
|
80
|
+
|
81
|
+
$res .= "\t\t<td>{$row['work']}</td>";
|
82
|
+
|
83
|
+
$res .= "\t\t<td>{$row['homepage_url']}</td>\n";
|
84
|
+
|
85
|
+
$res .= "\t\t<td>{$row['max_persons']}</td></tr>\n";
|
86
|
+
|
87
|
+
$res .= "\t\t<tr><td>{$row['establishment_location']}</td>";
|
88
|
+
|
89
|
+
$res .= "\t\t<td>{$row['tel']}</td>";
|
90
|
+
|
91
|
+
$res .= "\t\t<td colspan='2'>{$row['mail_adress']}</td>\n";
|
92
|
+
|
93
|
+
$res .= "\t</tr>\n";
|
94
|
+
|
95
|
+
}
|