teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

題名と質問の内容が違うということで変更しました。

2018/05/05 03:03

投稿

enpitsu
enpitsu

スコア8

title CHANGED
@@ -1,1 +1,1 @@
1
- データベースから値を取得してcsvファイルに書出す
1
+ SELECT文でデータ値を取得したいが、うまくcountでない
body CHANGED
@@ -1,22 +1,12 @@
1
- よろしくお願いいたします。
2
1
  **前提・実現したいこと**
3
- wordpressのプラグインslimstatのPV数と訪問数に取得しcsvに書き出したい
4
- ①「一日毎のPV数を取得したい」
5
- ![イメージ説明](bd72373c8e3de4c16f7288211bfeb920.png)
6
- ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数を表示しているコード**
7
- <p><?php _e('Today', 'wp-slimstat'); ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'dt > '.(date_i18n('U', mktime(0, 0, 0, date_i18n('m'), date_i18n('d'), date_i18n('Y')))), false), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
2
+ wordpressのプラグインslimstatのPV数を1ごとに取得したい
8
3
 
4
+ **発生している問題**
9
5
 
10
- ②S「一日毎の訪問数を取得したい」
11
- ![イメージ説明](3362870d3b2aca0b780d361c55b395a5.png)
12
- ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示しるコード**
6
+ 5/4と5/5のPVを合計して一行で表示し
13
- <?php _e( 'Visits', 'wp-slimstat' ) ?> <span><?php echo number_format( $total_human_visits, 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
14
7
 
15
- テーブル:wp_slim_stats
16
- カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
8
+ select select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', count(id) as 'PV数'
9
+ from wp.wp_slim_stats
10
+ group by dt;
17
11
 
18
- **発生している問題**
19
- SELECT文でデータの値を取得したいが、うまくcountできない
20
- select b.日付, count(b.id) as 'PV数'
12
+ ![イメージ説明](79e5a969f928b2814296b21b3482cac9.png)
21
- from(select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', id, dt from wp_soumu.wp_slim_stats) b
22
- group by b.日付

2

SELECT文追加しました

2018/05/05 03:03

投稿

enpitsu
enpitsu

スコア8

title CHANGED
File without changes
body CHANGED
@@ -16,4 +16,7 @@
16
16
  カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
17
17
 
18
18
  **発生している問題**
19
- SELECT文でデータの値を取得したいが、うまくcountできない
19
+ SELECT文でデータの値を取得したいが、うまくcountできない
20
+ select b.日付, count(b.id) as 'PV数'
21
+ from(select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', id, dt from wp_soumu.wp_slim_stats) b
22
+ group by b.日付

1

すみません。発生している問題をついかしました。

2018/05/01 11:33

投稿

enpitsu
enpitsu

スコア8

title CHANGED
@@ -1,1 +1,1 @@
1
- データベースから値を取得してcsvに書き出す
1
+ データベースから値を取得してcsvファイルに書き出す
body CHANGED
@@ -1,15 +1,19 @@
1
1
  よろしくお願いいたします。
2
+ **前提・実現したいこと**
2
- wordpressのプラグイン「slimstat」のPV数と訪問数を日毎に取得しcsvに書き出したい
3
+ wordpressのプラグイン「slimstat」のPV数と訪問数を日毎に取得しcsvに書き出したい
3
4
  ①「一日毎のPV数を取得したい」
4
5
  ![イメージ説明](bd72373c8e3de4c16f7288211bfeb920.png)
5
- ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数表示**
6
+ ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数表示しているコード**
6
7
  <p><?php _e('Today', 'wp-slimstat'); ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'dt > '.(date_i18n('U', mktime(0, 0, 0, date_i18n('m'), date_i18n('d'), date_i18n('Y')))), false), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
7
8
 
8
9
 
9
10
  ②S「一日毎の訪問数を取得したい」
10
11
  ![イメージ説明](3362870d3b2aca0b780d361c55b395a5.png)
11
- ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示**
12
+ ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示しているコード**
12
13
  <?php _e( 'Visits', 'wp-slimstat' ) ?> <span><?php echo number_format( $total_human_visits, 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
13
14
 
14
15
  テーブル:wp_slim_stats
15
- カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
16
+ カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
17
+
18
+ **発生している問題**
19
+ SELECT文でデータの値を取得したいが、うまくcountできない