function add_date($yyyymmdd, $dif) { $yyyy = substr($yyyymmdd, 0, 4); $mm = substr($yyyymmdd, 4, 2); $dd = substr($yyyymmdd, 6, 2); $a_U = date("U", mktime(0, 0, 0, $mm, $dd, $yyyy)); $a_D = $a_U + ($dif * 24 * 60 * 60); $add_date = date("Ymd", $a_D); return $add_date; } $mode = $_GET["mode"]; $order = $_GET["order"]; if (empty($mode)) { $mode = "create_time"; $order = "desc"; } if ($mode == "title_kana") $mode_str = "あいうえお"; if ($mode == "create_time") $mode_str = "新着"; include "data/db.inc"; db_connect ($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DBNAME); $sql = "select * from link "; if (!empty($ken)) $sql .= "where ken = \"$ken\""; $sql .= "order by $mode "; if (!empty($order)) $sql .= "$order "; $res = mysql_query($sql) or error(__FILE__, __LINE__, "Database Error", "$sql", true); ?>
【お問い合わせ】 |
フットサルタイムズトップへ - リンク |
|
echo "※" . $mode_str . "順に表示しています。
"; echo "→ あいうえお順(昇順/降順)で表示 "; echo "→ 新着順(昇順/降順)で表示 "; echo " \n"; while (list($id_, $title_, $title_kana_, $url_, $caption_, $category1_, $category2_, $category3_, $ken_, $email_, $tanto_, $biko_, $yuko_, $create_time_, $update_time_) = mysql_fetch_row($res)) { # $title_ = addslashes($title_); # $caption_ = addslashes($caption_); $create_Y = substr($create_time_, 0, 4); $create_m = substr($create_time_, 5, 2); $create_d = substr($create_time_, 8, 2); $create_date = $create_Y . $create_m . $create_d; $today = date("Ymd"); $date7 = add_date($today, -7); if ($date7 <= $create_date) $new_str = "NEW !!"; else $new_str = ""; echo " \n"; } ?> |