簡體   English   中英

從MYSQL PHP中的特定類別中排除項目

[英]Exclude Items from a Specific category in MYSQL PHP

以下代碼將從數據庫中存在的所有類別中獲取所有最新項目。 我想隱藏特定類別的所有項目,因此它不顯示該特定類別的項目,但仍顯示其他類別的項目。

$query="
SELECT t1 . *,
DATEDIFF( t1.date_added, '$curDate' ) as remaining,
at.auctions_type_name
FROM wp_mam_auctions AS t1
INNER JOIN wp_mam_auction_type AS at ON at.auctions_type_id = t1.auction_type_id
WHERE  t1.auction_status_id = '1' AND t1.sold='0'
AND DATEDIFF( t1.date_added, '$curDate' ) <= '0'
AND DATEDIFF( t1.date_added, '$curDate' ) >= '-$new_listing_days'
AND TIMESTAMPDIFF(MINUTE , '$curDate', t1.date_expiry ) >'0'
ORDER BY date_added DESC LIMIT $from1, $max_results1
";

添加一個where子句,並說不顯示那些類別的項目。 喜歡

 WHERE category!="blah"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM