728x90
<?
// 가장 최근의 reg_date 가져오기
$sql01 = "SELECT reg_date FROM homepage_page_content WHERE using_bit=1 AND folder_page_no='300' ORDER BY reg_date DESC LIMIT 1";
$result01 = mysql_query($sql01);
$arr01=sql_fetch_array($result01);
$regDate=$arr01[reg_date];
// reg_date에서 연도 부분만 추출
$year = substr($regDate, 0, 4);
$month = substr($regDate, 5, 2);
?>
<div class="month-picker">
<select name="year" id="year">
<option value="2024" <?= $year == '2024' ? 'selected' : '' ?>>2024</option>
<option value="2025" <?= $year == '2025' ? 'selected' : '' ?>>2025</option>
<option value="2026" <?= $year == '2026' ? 'selected' : '' ?>>2026</option>
<option value="2027" <?= $year == '2027' ? 'selected' : '' ?>>2027</option>
</select>
<?php for ($i = 1; $i <= 12; $i++): ?>
<a href="#" class="is <?= $i == (int)$month ? 'on' : '' ?>"><?= $i ?></a>
<?php endfor; ?>
<div class="picker">
<div class="month"></div>
</div>
</div>
728x90
'php' 카테고리의 다른 글
[php] 데이터베이스 날짜 select (0) | 2024.07.22 |
---|