prepare($query); $stmt -> execute(); $calendar = $stmt -> fetch(PDO::FETCH_ASSOC); //$calendar_img = $calendar['calendar_img']; // while($row = $stmt -> fetch(PDO::FETCH_ASSOC)){ // $calendar_img = $row['calendar_img']; // } } catch(PDOException $e){ var_dump($e -> getMessage()); } // whats_newに基づき記事の取得まで /////////////////////////////////////////////////// try { $query = "SELECT * FROM ". WHATS_NEW; $stmt = $pdo -> prepare($query); $stmt -> execute(); $whats_new = $stmt -> fetch(PDO::FETCH_ASSOC); $category_id_set = $whats_new['category_id_set']; //$calendar_img = $calendar['calendar_img']; // while($row = $stmt -> fetch(PDO::FETCH_ASSOC)){ // $calendar_img = $row['calendar_img']; // } //echo $category_id_set; preg_match_all("/\[(.+?)\]/", $category_id_set, $category_id_array); //$result_num = count($category_id[1]); $whats_new_cont = ''; for($i = 0; $i < 4; $i++){ $category_id = $category_id_array[1][$i]; // カテゴリーデータ取得 $query = "SELECT * FROM ". CATEGORY . " WHERE category_id = " . $category_id; $stmt = $pdo -> prepare($query); $stmt -> execute(); $category = $stmt -> fetch(PDO::FETCH_ASSOC); $whats_new_cont .= '
' . "\n"; $whats_new_cont .= '
' . "\n"; // 記事取得 $query = "SELECT * FROM ". NEWS . " WHERE category_id = " . $category_id . " order by news_id desc LIMIT 1"; $stmt = $pdo -> prepare($query); $stmt -> execute(); $news = $stmt -> fetch(PDO::FETCH_ASSOC); $post_date = substr( $news['post_date'], 0, 10); $post_date = str_replace('-', '/', $post_date); $whats_new_cont .= '' . "\n"; $whats_new_cont .= '

' . $category['category_name'] . '

' . "\n"; $whats_new_cont .= '
' . "\n"; $whats_new_cont .= '' . "\n"; $whats_new_cont .= '

' . $news['news_title'] . '

' . "\n"; $whats_new_cont .= '
' . "\n"; $whats_new_cont .= '
' . "\n"; $whats_new_cont .= '
' . "\n\n"; } } catch(PDOException $e){ var_dump($e -> getMessage()); } ?>
カレンダー

what's new