You are missing one AND operator:
1. article_showhome=1 article_expire_date>CURDATE()
yeah, experimenting with it, I forgot to copy paste the right one.
Sounds like you want something like this:
1. SELECT * FROM articles WHERE article_showhome=1 AND (article_expirehome='0' OR (article_expirehome='1' AND article_expire_date>CURDATE() AND article_expire_time>CURTIME())) ORDER BY article_importance ASC LIMIT 10
Yes this does the job so far, but articles who have article_expirehome as value 0, try to get compared with CURTIME()/CURDATE() as well and don't show up as their values are probably '0000-00-00' and '00:00:00'. Is there anyway to avoid this comparison so those entries can be displayed as well?
I am trying something like this but it doesn't work,
Code: Select all
$query = "SELECT * FROM articles WHERE article_showhome=1 AND ((article_expirehome='0' AND article_expire_date='0000-00-00' AND article_expire_time='00:00:00') OR (article_expirehome='1' AND article_expire_date>CURDATE() AND article_expire_time>CURTIME())) ORDER BY article_importance ASC LIMIT 10";
entries with article_expirehome='0' do not show at all because their date is 0000-00-00 which is lower than CURDATE.