MyBB Community Forums

Full Version: selecting query within the past 30 days
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I put this in general as all i am really asking is how to select from MYSQL

I am using the unanswered post plugin. I am trying to change this plugin to add 0 responses and within the past 30 days instead of the default just 0 posts. This plugin selects from the database via (i think)



       $sql = "SELECT tid
           FROM " . TABLE_PREFIX . "threads 
           WHERE {$this->where}
           ORDER BY dateline DESC
           LIMIT 500";
       $result = $db->query($sql);

I tried add and and condition such as...


       $sql = "SELECT tid
           FROM " . TABLE_PREFIX . "threads 
           WHERE {$this->where}
           and dateline >= date_add(now(), interval -30 day)
           ORDER BY dateline DESC
           LIMIT 500";
       $result = $db->query($sql);

But that is not working. I dont get any search results at all. 

Mysql version info


root /# mysql --version
mysql  Ver 14.14 Distrib 5.5.44, for debian-linux-gnu (x86_64) using readline 6.3

the plugin in which i am using
https://github.com/lukasamd/MyBB-View_Unanswered_Posts

The line in that plugin in which selects MYSQL search
https://github.com/lukasamd/MyBB-Vie...Posts.php#L200

I also tried


WHERE t.date >= DATE_ADD(CURDATE(), INTERVAL '-30' DAY);

with and without quotes, but i get a mysql error