mb_http_output('SJIS');
mb_internal_encoding('SJIS');
header('Content-type: text/html; charset=Shift_JIS');
#ini_set('session.use_cookies', 0);
#session_cache_limiter('nocache');
session_start();
#---パラメータ取得
$MakerCode = $_REQUEST['MakerCode'];
$CarCode = $_REQUEST['CarCode'];
$CategoryCode = $_REQUEST['CategoryCode'];
$Keyword = $_REQUEST['Keyword'];
#---データベース接続
require("config.php");
$con =mysql_connect(HOST,USER,PASS)
or die("接続できません");
$result1 = mysql_select_db(DBNAME,$con)
or die("データベースがありません");
#---メーカーマスターからデータを配列に展開
$maker = array();
$sql = "SELECT MakerCode,MakerName FROM m_maker ";
$result = mysql_query($sql,$con);
$maker_max = mysql_num_rows($result);
while($row = mysql_fetch_assoc($result))
{
$code = $row[MakerCode];
$name = mb_convert_encoding($row[MakerName],'SJIS','EUC-JP');
array_push($maker,compact('name','code'));
}
sort($maker);
#---商品テーブルから車種データを配列に展開
$car = array();
if($MakerCode<>""){
$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() ?>