質問編集履歴
1
初心者なりに補足説明を足しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,6 +8,198 @@
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
```tweets.json
|
12
|
+
|
13
|
+
{
|
14
|
+
|
15
|
+
"statuses": [
|
16
|
+
|
17
|
+
{
|
18
|
+
|
19
|
+
"created_at": "略1",
|
20
|
+
|
21
|
+
"id": "略1",
|
22
|
+
|
23
|
+
"id_str": "略1",
|
24
|
+
|
25
|
+
"text": "#テスト\n略1。",
|
26
|
+
|
27
|
+
"truncated": false,
|
28
|
+
|
29
|
+
"entities": {
|
30
|
+
|
31
|
+
"hashtags": [
|
32
|
+
|
33
|
+
{
|
34
|
+
|
35
|
+
"text": "テスト",
|
36
|
+
|
37
|
+
"indices": [
|
38
|
+
|
39
|
+
0,
|
40
|
+
|
41
|
+
7
|
42
|
+
|
43
|
+
]
|
44
|
+
|
45
|
+
}
|
46
|
+
|
47
|
+
],
|
48
|
+
|
49
|
+
"symbols": [],
|
50
|
+
|
51
|
+
"user_mentions": [],
|
52
|
+
|
53
|
+
"urls": []
|
54
|
+
|
55
|
+
},
|
56
|
+
|
57
|
+
"metadata": {
|
58
|
+
|
59
|
+
"iso_language_code": "ja",
|
60
|
+
|
61
|
+
"result_type": "recent"
|
62
|
+
|
63
|
+
},
|
64
|
+
|
65
|
+
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
|
66
|
+
|
67
|
+
"in_reply_to_status_id": null,
|
68
|
+
|
69
|
+
"in_reply_to_status_id_str": null,
|
70
|
+
|
71
|
+
"in_reply_to_user_id": null,
|
72
|
+
|
73
|
+
"in_reply_to_user_id_str": null,
|
74
|
+
|
75
|
+
"in_reply_to_screen_name": null,
|
76
|
+
|
77
|
+
"user": {
|
78
|
+
|
79
|
+
"id": "1075985828399046656",
|
80
|
+
|
81
|
+
"id_str": "1075985828399046656",
|
82
|
+
|
83
|
+
"name": "略1",
|
84
|
+
|
85
|
+
"screen_name": "略1",
|
86
|
+
|
87
|
+
"location": "",
|
88
|
+
|
89
|
+
"description": "略1",
|
90
|
+
|
91
|
+
"url": null,
|
92
|
+
|
93
|
+
"entities": {
|
94
|
+
|
95
|
+
"description": {
|
96
|
+
|
97
|
+
"urls": []
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
{
|
104
|
+
|
105
|
+
"created_at": "略2",
|
106
|
+
|
107
|
+
"id": "1140596976062304256",
|
108
|
+
|
109
|
+
"id_str": "1140596976062304256",
|
110
|
+
|
111
|
+
"text": "#テスト/n略2",
|
112
|
+
|
113
|
+
"truncated": false,
|
114
|
+
|
115
|
+
"entities": {
|
116
|
+
|
117
|
+
"hashtags": [
|
118
|
+
|
119
|
+
{
|
120
|
+
|
121
|
+
"text": "テスト",
|
122
|
+
|
123
|
+
"indices": [
|
124
|
+
|
125
|
+
0,
|
126
|
+
|
127
|
+
7
|
128
|
+
|
129
|
+
]
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
],
|
134
|
+
|
135
|
+
"symbols": [],
|
136
|
+
|
137
|
+
"user_mentions": [],
|
138
|
+
|
139
|
+
"urls": []
|
140
|
+
|
141
|
+
},
|
142
|
+
|
143
|
+
"metadata": {
|
144
|
+
|
145
|
+
"iso_language_code": "ja",
|
146
|
+
|
147
|
+
"result_type": "recent"
|
148
|
+
|
149
|
+
},
|
150
|
+
|
151
|
+
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
|
152
|
+
|
153
|
+
"in_reply_to_status_id": null,
|
154
|
+
|
155
|
+
"in_reply_to_status_id_str": null,
|
156
|
+
|
157
|
+
"in_reply_to_user_id": null,
|
158
|
+
|
159
|
+
"in_reply_to_user_id_str": null,
|
160
|
+
|
161
|
+
"in_reply_to_screen_name": null,
|
162
|
+
|
163
|
+
"user": {
|
164
|
+
|
165
|
+
"id": "1075985828399046656",
|
166
|
+
|
167
|
+
"id_str": "1075985828399046656",
|
168
|
+
|
169
|
+
"name": "略2",
|
170
|
+
|
171
|
+
"screen_name": "略2",
|
172
|
+
|
173
|
+
"location": "",
|
174
|
+
|
175
|
+
"description": "略2",
|
176
|
+
|
177
|
+
"url": null,
|
178
|
+
|
179
|
+
"entities": {
|
180
|
+
|
181
|
+
"description": {
|
182
|
+
|
183
|
+
"urls": []
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
}
|
188
|
+
|
189
|
+
```
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
このようにデータを持っていて(ツイートデータで長いので略してます)、そこから"id","id_str","name","screen_name","text","created_at"の部分をツイート別に格納したいです。↓こんな感じに
|
194
|
+
|
195
|
+
|id|id_str|name|screen_name|tweets|created_at|
|
196
|
+
|
197
|
+
|:---:|:---:|:---:|:---:|:---:|:---:|
|
198
|
+
|
199
|
+
|略1|略1|略1|略1|略1|略1|
|
200
|
+
|
201
|
+
|略2|略2|略2|略2|略2|略2|
|
202
|
+
|
11
203
|
### 発生している問題・エラーメッセージ
|
12
204
|
|
13
205
|
|
@@ -62,7 +254,7 @@
|
|
62
254
|
|
63
255
|
$name[] = $json3["statuses"][$i]["user"]["name"];
|
64
256
|
|
65
|
-
$t
|
257
|
+
$text[] = $json3["statuses"][$i]["text"];
|
66
258
|
|
67
259
|
$id[] = $json3["statuses"][$i]["id"];
|
68
260
|
|
@@ -100,7 +292,7 @@
|
|
100
292
|
|
101
293
|
$stmt = $sql->prepare($params);
|
102
294
|
|
103
|
-
$stmt->execute(array(':id'=>$id, ':id_str'=>$id_str, ':name'=>$name, ':screen_name'=>$screen_name, 'tweets'=>$t
|
295
|
+
$stmt->execute(array(':id'=>$id, ':id_str'=>$id_str, ':name'=>$name, ':screen_name'=>$screen_name, 'tweets'=>$text, 'created_at'=>$created_at));}
|
104
296
|
|
105
297
|
|
106
298
|
|