0){ // AND なり OR で連結してWHERE を作成 $sql_add = " AND `Shikutyouson` in(" . implode(",",$tmp).") "; } } if($_GET[eki] && $_GET[eki][0] != '0'){ $all = ''; $vi = ''; $all ++; $input = $_GET[eki]; foreach($input as $val_1){ $vi .= $val_1." "; } $input = $vi; $keywords = preg_split("/[\s]+/",$input); $tmp = array(); foreach($keywords as $kw){ if($kw == ""){ // 空っぽなら無視 }else{ $tmp[] = "'".mysql_real_escape_string($kw)."'"; } } if(count($tmp) > 0){ // AND なり OR で連結してWHERE を作成 $sql_eki = " AND (`Rosen1_Eki` in(" . implode(",",$tmp).") OR `Rosen2_Eki` in(" . implode(",",$tmp).") OR `Rosen3_Eki` in(" . implode(",",$tmp).")) "; } } if($_GET[line] && $_GET[line][0] != '0'){ $all = ''; $vi = ''; $all ++; $input = $_GET[line]; foreach($input as $val_1){ $vi .= $val_1." "; } $input = $vi; $keywords = preg_split("/[\s]+/",$input); $tmp = array(); foreach($keywords as $kw){ if($kw == ""){ // 空っぽなら無視 }else{ $tmp[] = "'".mysql_real_escape_string($kw)."'"; } } if(count($tmp) > 0){ // AND なり OR で連結してWHERE を作成 $sql_bk_line = " AND (`Rosen1_Rosen` in(" . implode(",",$tmp).") OR `Rosen2_Rosen` in(" . implode(",",$tmp).") OR `Rosen3_Rosen` in(" . implode(",",$tmp).")) "; $sql_line = " AND `line_name` in(" . implode(",",$tmp).") "; } } if($_GET[k_word] && $_GET[k_word][0] != '0'){ $all = ''; $vi = ''; $all ++; $input = $_GET[k_word]; foreach($input as $val_1){ $vi .= $val_1." "; } $input = $vi; $keywords = preg_split("/[\s]+/",$input); $tmp = array(); foreach($keywords as $kw){ if($kw == ""){ // 空っぽなら無視 }else{ $tmp[] = "'".mysql_real_escape_string($kw)."'"; } } if(count($tmp) > 0){ // AND なり OR で連結してWHERE を作成 $sql_keyword = " AND `Kodawari_Koumoku` in(" . implode(",",$tmp).") "; } } if($_GET[pri_h] != 0 ){ $sql_pri .= " AND `Kakaku1` <= " . $_GET[pri_h]; } if($_GET[pri_l] != 0 ){ $sql_pri .= " AND `Kakaku1` >= " . $_GET[pri_l]; } if($_GET[vol_h] != 0 ){ $sql_vol .= " AND `Tochi1_Menseki` <= " . $_GET[vol_h]; } if($_GET[vol_l] != 0 ){ $sql_vol .= " AND `Tochi1_Menseki` >= " . $_GET[vol_l]; } if($_GET[bil_h] != 0 ){ $sql_bil .= " AND `Tatemono1_Menseki` <= " . $_GET[bil_h]; } if($_GET[bil_l] != 0 ){ $sql_bil .= " AND `Tatemono1_Menseki` >= " . $_GET[bil_l]; } if($_GET[flo_h] != 0 ){ $sql_flo .= " AND `Madori1` <= " . $_GET[flo_h]; } if($_GET[flo_l] != 0 ){ $sql_flo .= " AND `Madori1` >= " . $_GET[flo_l]; } /* if($_GET[expiration] == 1 ){ $sql_exp .= " AND `expiration` = 1 "; } if($_GET[expiration] == 2 ){ $sql_exp .= " AND `expiration` = 2 "; } if($_GET[expiration] == 3 ){ $sql_exp .= " AND `expiration` BETWEEN 2 AND 3 "; } */ $query_all .= $sql_add; $query_all .= $sql_bk_line; $query_all .= $sql_eki; $query_all .= $sql_keyword; $query_all .= $sql_pri; $query_all .= $sql_vol; $query_all .= $sql_bil; $query_all .= $sql_flo; $query_all .= $sql_exp; //if(!$_GET[sorting]){ $sorting = ' ORDER BY Datetime_Edit DESC'; //} switch($_GET[sorting]){ case 'img_down': $sorting = ' ORDER BY Gazou1_Com ASC, Datetime_Edit DESC '; break; case 'img_up': $sorting = ' ORDER BY Gazou1_Com DESC, Datetime_Edit DESC '; break; case 'bus_up': $sorting = ' ORDER BY Rosen1_Basu DESC, Rosen1_Toho DESC, Datetime_Edit DESC '; break; case 'bus_down': $sorting = ' ORDER BY Rosen1_Basu ASC , Rosen1_Toho ASC, Datetime_Edit DESC' ; break; case 'toho_up': $sorting = ' ORDER BY Rosen1_Toho DESC, Rosen1_Basu DESC, Datetime_Edit DESC '; break; case 'toho_down': $sorting = ' ORDER BY Rosen1_Toho ASC, Rosen1_Basu ASC, Datetime_Edit DESC '; break; case 'price_up': $sorting = ' ORDER BY Kakaku1 DESC, Datetime_Edit DESC '; break; case 'price_down': $sorting = ' ORDER BY Kakaku1 ASC, Datetime_Edit DESC '; break; case 'vol_up': $sorting = ' ORDER BY Tochi1_Menseki DESC, Datetime_Edit DESC '; break; case 'vol_down': $sorting = ' ORDER BY Tochi1_Menseki ASC, Datetime_Edit DESC '; break; case 'vol2_up': $sorting = ' ORDER BY Senyu1_Menseki DESC, Datetime_Edit DESC '; break; case 'vol2_down': $sorting = ' ORDER BY Senyu1_Menseki ASC, Datetime_Edit DESC '; break; case 'bild_up': $sorting = ' ORDER BY Tatemono1_Menseki DESC, Datetime_Edit DESC '; break; case 'bild_down': $sorting = ' ORDER BY Tatemono1_Menseki ASC, Datetime_Edit DESC '; break; case 'portal_up': $sorting = ' ORDER BY expiration DESC , Portal_Flug ASC , Datetime_Edit DESC '; break; case 'portal_top_up': $sorting = ' ORDER BY expiration DESC , Portal_Top_Flug ASC , Portal_Flug DESC , Datetime_Edit DESC '; break; case 'view_up': $sorting = ' ORDER BY expiration DESC , Kiriwake_Flug ASC , Datetime_Edit DESC '; break; case 'top_up': $sorting = ' ORDER BY expiration DESC , Kiriwake_Top_Flug ASC , Kiriwake_Flug DESC , Datetime_Edit DESC '; break; case 'op_up': $sorting = ' ORDER BY expiration DESC , Genhan_Flug ASC , Datetime_Edit DESC '; break; case 'cu_up': $sorting = ' ORDER BY expiration DESC , Custom_Flug DESC , Datetime_Edit DESC '; break; case 'ap_up': $sorting = ' ORDER BY Area_pickup_Flug ASC , Datetime_Edit DESC '; break; default: $sorting=''; } //登録上限の処理-------------------------------------------------------------- $sql = " SELECT * FROM `corp_data` WHERE `id` = ".$_SESSION['MM_UserGroup']." "; $corp_data = mysql_fetch_assoc(mysql_query($sql, $con)); //ポータルtop $sql = " SELECT count( * ) FROM `es_list` WHERE `Portal_Flug` = 1 AND `Portal_Top_Flug` LIKE '1' AND `check_mode` LIKE 'OK' AND `expiration` >= 2 AND `Syubetsu_Syurui` < 19 ".$corp; $value = mysql_fetch_assoc(mysql_query($sql, $con)); $all_bk[reg_pt_count] = $value['count( * )']; $sql = " SELECT count( * ) FROM `es_list` WHERE `Portal_Flug` LIKE '1' AND `check_mode` LIKE 'OK' AND `expiration` >= 2 AND`Syubetsu_Syurui` < 19 ".$corp; $value = mysql_fetch_assoc(mysql_query($sql, $con)); $all_bk[reg_po_count] = $value['count( * )']; //売買登録件数取得 $sql = " SELECT count( * ) FROM `es_list` WHERE `Kiriwake_Flug` LIKE '1' AND `check_mode` LIKE 'OK' AND `expiration` >= 2 AND `Syubetsu_Syurui` < 19 ".$corp; $value = mysql_fetch_assoc(mysql_query($sql, $con)); $all_bk[Kiriwake_Flug] = $value['count( * )']; //echo $sql; if($all_bk[reg_pt_count] - $corp_data[portal_top_baibai] >= 0){ $portal_top_baibai = $all_bk[reg_pt_count] - $corp_data[portal_top_baibai]; } if($all_bk[reg_po_count] - $corp_data[portal_baibai] >= 0){ $portal_baibai = $all_bk[reg_po_count] - $corp_data[portal_baibai]; } if( $all_bk[Kiriwake_Flug] - $corp_data[baibai] >= 0){ $baibai = $all_bk[Kiriwake_Flug] - $corp_data[baibai]; } //echo $corp_data[baibai]; $sql = " UPDATE `es_list` SET `Portal_Top_Flug` = '0' WHERE `Portal_Flug` =1 AND `Portal_Top_Flug` = 1 ORDER BY `Datetime_Edit` ASC LIMIT ".$portal_top_baibai; $rst = mysql_query($sql, $con); $sql = " UPDATE `es_list` SET `Portal_Flug` = '0' , `Portal_Top_Flug` = '0' WHERE `Portal_Flug` = 1 AND `Portal_Top_Flug` = 0 ORDER BY `Datetime_Edit` ASC LIMIT ".$portal_baibai; $rst = mysql_query($sql, $con); //echo $sql; $sql = " UPDATE `es_list` SET `Kiriwake_Flug` = '0' , `Kiriwake_Top_Flug` = '0' WHERE `Kiriwake_Flug` = 1 AND `Kiriwake_Top_Flug` = 0 ORDER BY `Datetime_Edit` ASC LIMIT ".$baibai; $rst = mysql_query($sql, $con); //echo $sql; //echo $portal_top_baibai; //echo $portal_baibai; //echo $baibai;