【PR】映画好きな方はこちら【PR】

フィットネススタジオプログラム検索

"; } if ($_GET['c'] != 0) { echo $shopname."の週間プログラム一覧です。"; } if ($_GET['i'] != 0) { echo $instractorname_utf."インストラクターの週間プログラム一覧です。"; } ?>


" />
= '12:00:00') AND (s_StartTime < '18:00:00')) "; break; case 3 : $sqlwhere .= "(s_StartTime >= '18:00:00') "; break; } } $sqlwhere .= ") "; } //店舗名 if ($_POST['freewords'] != '') { $sqlwhere .= "AND ".GetSqlWhereFromText($_POST['freewords'], "s_Shop_Name", "OR"); } //プログラム名 if ($_POST['freewordp'] != '') { $sqlwhere .= "AND ".GetSqlWhereFromText($_POST['freewordp'], "s_Program_Name", "OR"); } //インストラクター名 if ($_POST['freewordi'] != '') { $sqlwhere .= "AND ".GetSqlWhereFromText($_POST['freewordi'], "s_Instractor_Name", "OR"); } //祝日でない場合は曜日データベースより検索、祝日の場合は日付データベースより検索 if ($_POST['dayselect'] == 'direct') { if (IsSpecialHoliday($year, $month, $day)) { //祝日の場合 $sql = 'FROM FITNESS_PROGRAM_DATA, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA '. 'WHERE (FITNESS_PROGRAM_DATA.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_DATA.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND '. '(FITNESS_PROGRAM_DATA.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND '.$sqlwhere.$sqlwheredate.$sqlorder; } else { //日付直接指定で祝日じゃない場合は指定月の曜日データベースより検索 $sql = 'FROM FITNESS_PROGRAM_WEEK, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA '. 'WHERE (FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_WEEK.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND '. '(FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND '. 'i_Month = '.$month.' AND '.$sqlwhere.$sqlwheredate.$sqlorder; } }else{ //日付直接指定じゃない場合は今月の曜日データベースより検索 $sql = 'FROM FITNESS_PROGRAM_WEEK, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA '. 'WHERE (FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_WEEK.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND '. '(FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND '. 'i_Month = '.date("n").' AND '.$sqlwhere.$sqlwheredate.$sqlorder; } } else if ($_GET['c'] != 0) { //cに指定がある場合は、店舗ごと検索 $sql = 'FROM FITNESS_PROGRAM_WEEK, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA '. 'WHERE (FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_WEEK.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND '. '(FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_WEEK.i_Company_ID = '.$_GET['c']. ') AND '. '(FITNESS_PROGRAM_WEEK.s_Shop_Key = \''.$_GET['s'].'\') AND i_Month = '.date("n").' ORDER BY i_Weekday, s_Place, s_StartTime'; //echo $sql; } else { //その他はインストラクター検索 $sql = 'FROM FITNESS_PROGRAM_WEEK, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA '. 'WHERE (FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND '. '(FITNESS_PROGRAM_WEEK.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND '. '(FITNESS_PROGRAM_WEEK.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND ' .GetSqlWhereFromText($instractorname_utf, "s_Instractor_Name", "OR" ) . " AND i_Month = ".date("n")." ORDER BY i_Weekday, s_Place, s_StartTime"; //echo $sql; } //echo $sql; //総数を算出 $result = mysql_query($count . $sql, $link); $row = mysql_fetch_row($result); $rowcount = $row[0]; if ($rowcount == 0) { echo "該当するプログラムはありませんでした。"; } else { $nowpageindex = intval($_POST["page"]); $limit = " LIMIT " . $nowpageindex * $ROW_PER_PAGE . "," . $ROW_PER_PAGE; //ページ変更ボタンを作成 $pagecount = (int)($rowcount / $ROW_PER_PAGE + 1) ; $nowpageindex = intval($_POST["page"]); echo $pagecount . "ページ中" . ($nowpageindex + 1) ."ページ目を表示しています。

"; echo ' '; $result = mysql_query($select . $sql . $limit, $link); //検索結果を一旦配列に溜め込む $i = 0; if (($_POST['dayselect'] == 'direct') && (IsSpecialHoliday($year, $month, $day) == true)) { while ($row = mysql_fetch_row($result)) { $tabledata[$i]['companyname'] = $row[22]; $tabledata[$i]['shopname'] =$row[12]; $tabledata[$i]['place'] = $row[3]; $tabledata[$i]['weekday'] = $_strWeekDay[ $row[6] ]; $tabledata[$i]['starttime'] = substr($row[5],0 ,5 ); $tabledata[$i]['programname'] = $row[7]; //代行チェック(代行の場合は赤) if ($row[9] != "") { $tabledata[$i]['instractorname'] = "".$row[9].""; } else { $tabledata[$i]['instractorname'] =$row[8]; } $i++; } $rowcount = $i; }else{ while ($row = mysql_fetch_row($result)) { $tabledata[$i]['companyname'] =$row[23]; $tabledata[$i]['shopname'] = $row[13]; $tabledata[$i]['place'] = $row[3]; $tabledata[$i]['weekday'] = $_strWeekDay[ $row[6] ]; $tabledata[$i]['starttime'] = substr($row[7],0 ,5 ); $tabledata[$i]['programname'] = $row[9]; $tabledata[$i]['instractorname'] = $row[10]; $i++; } $rowcount = $i; //日付直接指定の場合は、PROGRAM_DATAの当日検索結果を参照して、 //代行があったら変更 if ($_POST['dayselect'] == 'direct' ) { $sql = 'SELECT * FROM FITNESS_PROGRAM_DATA, FITNESS_SHOP_DATA, FITNESS_COMPANY_DATA WHERE (FITNESS_PROGRAM_DATA.i_Company_ID = FITNESS_SHOP_DATA.i_Company_ID) AND (FITNESS_PROGRAM_DATA.s_Shop_Key = FITNESS_SHOP_DATA.s_Shop_Key) AND (FITNESS_PROGRAM_DATA.i_Company_ID = FITNESS_COMPANY_DATA.i_Company_ID) AND '.$sqlwhere."AND (d_Date = '$year-$month-$day') ".$sqlorder; $result = mysql_query($sql, $link); $i = 0; while ($row = mysql_fetch_row($result)) { $companyname = $row[22]; $shopname = $row[12]; $place = $row[3]; $starttime = substr($row[5],0 ,5 ); $programname = $row[7]; $instractornamesub =$row[9]; $instractorname = $row[8]; for ($j = 0; $j < $rowcount ; $j++ ) { if ( ($tabledata[$j]['companyname'] == $companyname) && ($tabledata[$j]['shopname'] == $shopname) && ($tabledata[$j]['place'] == $place) && ($tabledata[$j]['starttime'] == $starttime) ) { //プログラム変更の場合 if ($tabledata[$j]['programname'] != $programname) { $tabledata[$j]['programname'] = "$programname"; } //代行の場合 if (instractornamesub != "") { $tabledata[$j]['instractorname'] = "$instractornamesub"; } } } } } } //配列の内容を表示 for ($i = 0; $i < $rowcount; $i++) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } mysql_free_result($result); mysql_close($link); echo "
会社名 店名 場所 曜日 時刻 プログラム名 インストラクタ名
".$tabledata[$i]['companyname']."".$tabledata[$i]['shopname']."".$tabledata[$i]['place']."".$tabledata[$i]['weekday']."".$tabledata[$i]['starttime']."".$tabledata[$i]['programname']."".$tabledata[$i]['instractorname']."
"; } ?>


$pagecount - 5) { $start_pageindex = $pagecount - 9; } else { $start_pageindex = $nowpageindex - 4; } if ($nowpageindex > 0) echo "" . 前ページ . " "; for ($i = 0 ; $i < 9; $i++) { if ($i + $start_pageindex == $pagecount) break; if ($i + $start_pageindex < 0) continue; if ($i + $start_pageindex == $nowpageindex) { $style = "style=\"font-weight:bold\" "; } else { $style = ""; } echo "" . ($i + $start_pageindex + 1) . " "; } if ($nowpageindex < $pagecount - 1) echo "" . 次ページ . " "; } ?>