Welcome Guest, Not a member yet? Register   Sign In
[Solved] Delete row if key code is there for more than 15 min
#6

(This post was last modified: 02-06-2017, 06:03 PM by wolfgang1983.)

(02-05-2017, 11:57 PM)Wouter60 Wrote: Just like the first "where" clause, add two extra paramaters NULL and FALSE to it:
PHP Code:
    $this->db->where('date_modified < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 15 MINUTE))',NULL,FALSE); 
This will override the normal syntax of db->where, which takes 2 parameters: fieldname and conditional value.

I did not work I placed the function in the construct area so once I reload page it checks it.


PHP Code:
public function __construct() {
      parent::__construct();
      $this->load->model('catalog/forum/newthread_model');
      $this->newthread_model->clear_unconfirmed_post();
 


What I am trying to achieve is if there is any columns in my table that still have a code present after 15 min then will remove that row.


date_modified looks like 2017-02-16 13:53:18

PHP Code:
public function clear_unconfirmed_post() {
    $this->db->where('code is NOT NULL'NULLFALSE);
    $this->db->where('date_modified < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 15 MINUTE))'NULLFALSE);
    $this->db->delete($this->db->dbprefix 'post');



[Image: 3BW8oHNZZMAP.png]
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
RE: Delete row if key code is there for more than 15 min - by wolfgang1983 - 02-06-2017, 06:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB