""){ $w_car = array(); $sql = "SELECT CarCode,CarName FROM t_syohin WHERE MakerCode = '" . sprintf("%03s",$MakerCode) . "'"; $result2 = mysql_query($sql,$con); $cnt = 0; while($row = mysql_fetch_array($result2)) { $cnt++; $code = $row[0]; $name = mb_convert_encoding($row[1],'SJIS','EUC-JP'); array_push($w_car,compact('name','code')); } sort($w_car); $car_max = 0; $code = $w_car[0]['code']; $name = $w_car[0]['name']; for($i=1;$i<$cnt;$i++){ if($code <> $w_car[$i]['code']){ if($code<>""){ $car_max++; array_push($car,compact('name','code')); } $code = $w_car[$i]['code']; $name = $w_car[$i]['name']; } } if($code<>""){ $car_max++; array_push($car,compact('name','code')); } } #---カテゴリマスタからデータを配列に展開 #---メーカー、車種が入力されている場合は、商品テーブルからカテゴリーを配列に展開 $category = array(); if($MakerCode <> ""){ $w_category = array(); $cnt=0; $sql = "SELECT Catgry1Code,Catgry1Name,Catgry2Code,Catgry2Name FROM t_syohin "; $sql = $sql . "WHERE MakerCode = '" . sprintf("%03s",$MakerCode) . "' "; if($CarCode <> ""){ $sql = $sql . "AND CarCode = '" . sprintf("%05s",$CarCode) . "' "; } $result3 = mysql_query($sql,$con); while($row = mysql_fetch_assoc($result3)) { if($row[Catgry1Code]<>""){ $cnt++; $code = $row[Catgry1Code]; $name = mb_convert_encoding($row[Catgry1Name],'SJIS','EUC-JP'); array_push($w_category,compact('name','code')); } if($row[Catgry2Code]<>""){ $cnt++; $code = $row[Catgry2Code]; $name = mb_convert_encoding($row[Catgry2Name],'SJIS','EUC-JP'); array_push($w_category,compact('name','code')); } } sort($w_category); $category_max = 0; $code = $w_category[0]['code']; $name = $w_category[0]['name']; for($i=1;$i<$cnt;$i++){ if($code <> $w_category[$i]['code']){ if($code <> ""){ $category_max++; array_push($category,compact('name','code')); } $code = $w_category[$i]['code']; $name = $w_category[$i]['name']; } } if($code<>""){ $category_max++; array_push($category,compact('name','code')); } } mysql_close($con); ?> PARTS LINE-UP<? session_id() ?>

 

[ Category Search ]
1.車輌メーカーを選択してください
2.車種名を選択して下さい
3.カテゴリー