2
---------------------------------------------------------------------------------------
| products_id | net_price | special_price | special_expire | special_status
| -------------------------------------------------------------------------------------
| 1 | 500 | 200 | 2012-5-03 00:00 | 1
| -------------------------------------------------------------------------------------
| 2 | 600 | 300 | 2012-6-04 00:00 | 0
| -------------------------------------------------------------------------------------
| 3 | 700 | 400 | 2012-7-05 00:00 | 1
---------------------------------------------------------------------------------------
が、
net_price
、
special_price
は、
special_expire
は自明である
とspecial_status
は1
を定義します。条件付き選択値
私には価格帯がある検索フォームがあります。
<form method="get" action="http://website.com">
<input type="text" id="ref-search" name="search" value="<?php echo $search_value;?>" class="text" size="55" placeholder="Type a keyword." style="height: 30px;
width: 89%;">
<label>Price Range:</label><br>
<span class="price-range">
From <input type="text" id="price1" name="pricefrom"
value="<?php echo $pricefrom_value; ?>" class="text" style="
height: 20px;
width: 22%;">
to <input type="text" id="price2" name="priceto"
value="<?php echo $priceto_value; ?>" class="text" style="
height: 20px;
width: 22%;">
</form>
私はどちらかspecial_price
が0.000
であれば、条件付きでnet_price
を選択するためのソリューションを開発するか、見つけるのに苦労してる、special_expire
日付値が経過したかspecial_status
の値は0
です。その後、special_price
に値がある場合は、special_expire
の日付値が渡されず、special_status
の値が1
である場合、special_price
の値を選択します。
これは私が欲しい画像です。 (私は、私は、これは私の問題を描くための最良の方法だと思い、これが不可能であることを知っているが。)
$sql = "select products_id, products_price, special_price, special_expire,
special_status, products_name from " . TABLE_GLOBAL_PRODUCTS . " where
products_name like '%" . $search_key . "%'
and /**Where the condition starts**/
if(special_value is =="0.000" || special_expire == <EXPIRED> ||
special_status =="0") {
products_price >= ".$pricefrom_key." and products_price <= ".$priceto_key."
} else {
specials_new_products_price >= ".$pricefrom_key."
and specials_new_products_price <= ".$priceto_key." order by products_name
}";
私は ありがとう..あなたが私に人を助けることができると思います。
魅力的な作品です!ありがとうございます!いいぞ! – Ken