Welcome Guest, Not a member yet? Register   Sign In
[Solved] Delete not working properly as wanted
#1

(This post was last modified: 02-13-2017, 03:07 AM by wolfgang1983.)

I have a column called code which stores a unique id when user previews a post.

If code is empty it should not remove the row. But for some reason deletes rows the code column is empty as well.

How can I make sure it only removes rows if code is present and has been there for more than 15min


PHP Code:
public function clear_unconfirmed_post() {
     $this->db->select('code');
     $this->db->from($this->db->dbprefix 'post');
     $query $this->db->get();

     if (!empty($query->row()->code)) {    
            
// The where below is OK
            $this->db->where('date_created < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 15 MINUTE))'NULLFALSE); 
            $this->db->delete($this->db->dbprefix 'post');
     }



I have tried


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

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
[Solved] Delete not working properly as wanted - by wolfgang1983 - 02-09-2017, 10:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB