'SET NAMES utf8mb4' ) ); $lastmonth = date('Y-m-01 00:00:00', strtotime( '-1 month' ) ); $sql = "SELECT * FROM `access_log` WHERE `type` = 'page' AND `unit` = 'month' AND `time` = '".$lastmonth."' AND `url` NOT LIKE '/test%' ORDER BY `count` DESC LIMIT 100;"; $resulte = $dbh->query( $sql ); $access_log_res = $resulte->fetchall(PDO::FETCH_ASSOC); ?> ランキング | OK! JAPAN | ライフスタイル&セレブリティーマガジン

RANKING
月刊ランキング

query( $sql ); $target_res = $resulte->fetchall(PDO::FETCH_ASSOC); if( !$target_res ) { $sql = "SELECT * FROM `report` WHERE `url` = '".$access_log_data['url']."' LIMIT 1 ;"; $resulte = $dbh->query( $sql ); $target_res = $resulte->fetchall(PDO::FETCH_ASSOC); $match_array['<-DB:target-subtitle->'] = ''; } if( $target_res ) { foreach( $target_res[0] as $db_key => $db_data ) { $match_array['<-DB:target-'.$db_key.'->'] = $db_data; } $match_array[ '<-DATE->' ] = date("Y.m.d", strtotime( $target_res[0]['open_time'] ) ); $match_array[ '<-RANKNO->' ] = ( $start_no + $i + 1 ); if( !file_exists( $_SERVER['DOCUMENT_ROOT'] . $match_array['<-DB:target-url->'] ) ) { $match_array['<-DB:target-url->'] = '/alert.html'; } } else { $match_array['<-DB:target-thumbnail->'] = ''; $match_array['<-DB:target-title->'] = '公開終了'; $match_array['<-DB:target-subtitle->'] = ''; $match_array['<-DB:target-url->'] = '/alert.html'; $match_array[ '<-DATE->' ] = ''; $match_array[ '<-RANKNO->' ] = ( $start_no + $i + 1 ); } $viewText = strtr( $tempText, $match_array ); echo $viewText; } ?>