Hello, lets imagine i have table
ads and table
ads holds banner links
adsClicks holds IP clicks on banner
I want to show user only link banners that user has not ever clicked or did click 24+ hours ago
Here is my code:
$time = time() + 86400; //PHP SELECT a.* FROM ads AS a WHERE ( (a.id NOT IN(SELECT ad FROM adsClicks WHERE ad=a.id AND ip='00.00.00.00')) OR (a.id IN(SELECT ad FROM adsClicks WHERE ad=a.id AND ip='00.00.00.00' AND time>'".$time."') ) AND a.status='Active' AND clicksLeft>0
Query does work but still does give banner links that user has clicked in last 24 hours
Whats the issue? Also maybe there are better way to write it (left join - could not figure out correct syntax)?
Thanks in advance!