検索結果バックアップ

 













$s_price =mb_convert_encoding($_POST[‘price’],”utf-8″,”utf-8″);
$s_f_postage=mb_convert_encoding($_POST[‘f_postage’],”utf-8″,”utf-8″);
$s_point =mb_convert_encoding($_POST[‘point’],”utf-8″,”utf-8″);
$s_pay=mb_convert_encoding($_POST[‘pay’],”utf-8″,”utf-8″);
$s_henkin=mb_convert_encoding($_POST[‘henkin’],”utf-8″,”utf-8″);
$s_teiki=mb_convert_encoding($_POST[‘teiki’],”utf-8″,”utf-8″);

// MySQL 接続
if (!($cn = mysqli_connect(“mysql908.xserver.jp”, “sworks_wp6”, “6cx1t55yb2”))) {
echo ‘DB接続不可’;
die;
}

// DB 接続
//mysqli_query(‘set character set utf8’);
mysqli_set_charset($cn, “utf8″);
if (!(mysqli_select_db($cn,”sworks_wp5”))) {
echo ‘DB選択不可’;
die;
}
//エントリー抽出
$sql_all = “select * from ranking2 where 1″;
$sql = $sql_all;
if($s_price != ”){
if($s_price == ‘1’){
$sql= $sql.’ and price < 1000′; }else if($s_price == ‘2’){ $sql= $sql.’ and (price >= 1000 and price < 2000)’; }else if($s_price == ‘3’){ $sql= $sql.’ and price >= 2000′;
}
}

if($s_f_postage != ”){
$sql= $sql.’ and f_postage in (“‘.$s_f_postage.'”)’;
}

if($s_point != ”){
$sql= $sql.’ and point like “%’.$s_point .’%”‘;
}

if($s_pay!= ”){
$sql= $sql.’ and kounyu like “%’.$s_pay.’%”‘;
}
if($s_henkin!= ”){
$sql= $sql.’ and henkin in (“‘.$s_henkin.'”)’;
}
if($s_teiki!= ”){
$sql= $sql.’ and teiki in (“‘.$s_teiki.'”)’;
}

//echo $sql.’
‘;

if (!($rs = mysqli_query($cn,$sql_all))) {
print “データが抽出できませんでした。”;
die;
}else{
$all_cnt = mysqli_num_rows($rs);
}

if (!($rs = mysqli_query($cn,$sql))) {
print ‘抽出結果は0/’.$all_cnt.’件でした。
条件を変えて検索してください’;
die;
}else{
$num = mysqli_num_rows($rs);
echo ‘検索結果は’.$num.’/’.$all_cnt.’件でした。’;
if ($num==0) {
print “条件を変えて検索してください。
“;
}
}
?>

$i = 1;
// 抽出データ表示
while ($item = mysqli_fetch_array($rs)) {
$name= mb_convert_encoding(“${item[name]}”, “utf-8”, “utf-8”);
$link= mb_convert_encoding(“${item[link]}”, “utf-8”);
$id= mb_convert_encoding(“${item[id]}”, “utf-8”);
$category= mb_convert_encoding(“${item[category]}”, “utf-8”);
$s_price= mb_convert_encoding(“${item[price]}”, “utf-8”);
if($s_price == 0){
$price = ‘初回無料’;
}else{
$price = $s_price . ‘円’;
}
$pay_1= mb_convert_encoding(“${item[pay_1]}”, “utf-8”);
$pay_2= mb_convert_encoding(“${item[pay_2]}”, “utf-8”);
$pay_3= mb_convert_encoding(“${item[pay_3]}”, “utf-8”);
$pay_4= mb_convert_encoding(“${item[pay_4]}”, “utf-8″);
$paymethod = ” “;
if($pay_1==”あり”){
$paymethod = $paymethod.”コンビニ払い “;
}
if($pay_2==”あり”){
$paymethod = $paymethod.”クレジット “;
}
if($pay_3==”あり”){
$paymethod = $paymethod.”代金引換 “;
}
if($pay_4==”あり”){
$paymethod = $paymethod.”Amazon Pay “;
}
$f_postage= mb_convert_encoding(“${item[f_postage]}”, “utf-8”);
$guarantee= mb_convert_encoding(“${item[guarantee]}”, “utf-8”);
$point= mb_convert_encoding(“${item[point]}”, “utf-8”);
$seibun= mb_convert_encoding(“${item[seibun]}”, “utf-8”);
$syokai= mb_convert_encoding(“${item[syokai]}”, “utf-8”);
$henkin= mb_convert_encoding(“${item[henkin]}”, “utf-8”);
$kounyu= mb_convert_encoding(“${item[kounyu]}”, “utf-8”);
$comment= mb_convert_encoding(“${item[comment]}”, “utf-8”);echo ‘

◆特徴
‘.$comment.’
価格
‘.$price.’
こだわり
‘.$point.’
成分
‘.$seibun.’
送料
‘.$f_postage.’
初回特典
‘.$syokai.’
返金保証
‘.$henkin.’
購入方法
‘.$kounyu.’

‘;
}

// MySQL 切断
mysqli_close($cn);
?>