Hi, can anyone tell me how to convert this:
$query = $this->EE->db->query("SELECT entry_id, entry_date FROM exp_twitter WHERE entry_date < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL " . $this->tw_tweet_interval_limit . " " . $this->tw_tweet_interval . "))");to something like this:
$this->EE->db->select('entry_id, entry_date');
$this->EE->db->where('entry_date <', 'UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL ' . $this->tw_tweet_interval_limit . ' ' . $this->tw_tweet_interval . ')))');
$query = $this->EE->db->get('exp_twitter');at the moment the Active Record select is being skipped.
Thanks
Incase this is of use to anyone, here is the solution I found.
$this->EE->db->select('entry_id, pub_date');
$this->EE->db->where('pub_date <', 'UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL ' . $this->EE->db->escape_str($this->rss_feed_interval_limit) . ' ' . $this->EE->db->escape_str($this->rss_feed_interval) . '))', FALSE);
$query = $this->EE->db->get('exp_rss_feed_data');Adding the FALSE parameter to WHERE stops Active Record from doing an automatic escape.
$this->db->where() accepts an optional third parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.