function requestNew()
    {
        $db = new Db;

        //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours.
        $result = $db->query('SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid
                              FROM article
                              WHERE status = 6
                              OR (status = 5 AND editdate <=  STR_TO_DATE(\''.date('Y-m-d H:i:s', time()-86400).'\', \'%Y-%m-%d %H:%i:%s\'))');

        if (isset($result[0])) {
            $this->editdate = date('Y-m-d H:i:s');
            $this->pubdate = $this->editdate;


            //Criando novo registro
            if ($result[0]->get('id') == null) {
                $this->id = $result[0]->get('nid');

                $db->query('INSERT INTO articlecontent
                           SET article = '.$this->id.',
                           	   content = "",
            				   editdate = "'.$this->editdate.'"');

                $db->query('INSERT INTO article
                           SET id = '.$this->id.',
                               status = 5,
                               editdate = \''.$this->editdate.'\'');

            //Atualizando o registro
            } else {
                $this->id = $result[0]->get('id');

                $db->query('UPDATE article
                           SET status = 5,
                               pubdate = \''.$this->pubdate.'\',
            				   editdate = \''.$this->editdate.'\',
            				   rateup = 0,
            				   ratedown = 0,
            				   access = 0,
            				   link = "",
            				   tags = "",
            				   title = "",
            				   media = "{}",
            				   resume = ""
            				   
            			 WHERE id = '.$this->id.'');

                $db->query('UPDATE articlecontent
                           SET content = "",
            				   editdate = \''.$this->editdate.'\'
            			 WHERE article = '.$this->id.'');
            }

                //Make dir clean (delete all files)
                $this->clearDir();
                return $this;
        }

            return false;
    }
function requestNew()
    {
        $db = new Db;

        //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours.
        $result = $db->query('SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid
                              FROM article
                              WHERE status = 6
                              OR (status = 5 AND editdate <=  STR_TO_DATE(\''.date('Y-m-d H:i:s', time()-86400).'\', \'%Y-%m-%d %H:%i:%s\'))');

        if (isset($result[0])) {
            $this->editdate = date('Y-m-d H:i:s');
            $this->pubdate = $this->editdate;


            //Criando novo registro
            if ($result[0]->get('id') == null) {
                $this->id = $result[0]->get('nid');

                $db->query('INSERT INTO articlecontent
                           SET article = '.$this->id.',
                           	   content = "",
            				   editdate = "'.$this->editdate.'"');

                $db->query('INSERT INTO article
                           SET id = '.$this->id.',
                               status = 5,
                               editdate = \''.$this->editdate.'\'');

            //Atualizando o registro
            } else {
                $this->id = $result[0]->get('id');

                $db->query('UPDATE article
                           SET status = 5,
                               pubdate = \''.$this->pubdate.'\',
            				   editdate = \''.$this->editdate.'\',
            				   rateup = 0,
            				   ratedown = 0,
            				   access = 0,
            				   link = "",
            				   tags = "",
            				   title = "",
            				   media = "{}",
            				   resume = ""
            				   
            			 WHERE id = '.$this->id.'');

                $db->query('UPDATE articlecontent
                           SET content = "",
            				   editdate = \''.$this->editdate.'\'
            			 WHERE article = '.$this->id.'');
            }

                //Make dir clean (delete all files)
                $this->clearDir();
                return $this;
        }

            return false;
    }
function requestNew ( ) { $ db = new Db ; //Search from first register with [article.status] 5 and [article.editdate] <= datetime - 24 hours. $ result = $ db -> query ( 'SELECT MIN(id)id, (SELECT MAX(id+1) FROM article)nid
                              FROM article
                              WHERE status = 6
                              OR (status = 5 AND editdate <=  STR_TO_DATE(\'' . date ( 'Y-m-d H:i:s' , time ( ) - 86400 ) . '\', \'%Y-%m-%d %H:%i:%s\'))' ) ; if ( isset ( $ result [ 0 ] ) ) { $ this -> editdate = date ( 'Y-m-d H:i:s' ) ; $ this -> pubdate = $ this -> editdate ; //Criando novo registro if ( $ result [ 0 ] -> get ( 'id' ) == null ) { $ this -> id = $ result [ 0 ] -> get ( 'nid' ) ; $ db -> query ( 'INSERT INTO articlecontent
                           SET article = ' . $ this -> id . ',
                           	   content = "",
            				   editdate = "' . $ this -> editdate . '"' ) ; $ db -> query ( 'INSERT INTO article
                           SET id = ' . $ this -> id . ',
                               status = 5,
                               editdate = \'' . $ this -> editdate . '\'' ) ; //Atualizando o registro } else { $ this -> id = $ result [ 0 ] -> get ( 'id' ) ; $ db -> query ( 'UPDATE article
                           SET status = 5,
                               pubdate = \'' . $ this -> pubdate . '\',
            				   editdate = \'' . $ this -> editdate . '\',
            				   rateup = 0,
            				   ratedown = 0,
            				   access = 0,
            				   link = "",
            				   tags = "",
            				   title = "",
            				   media = "{}",
            				   resume = ""
            				   
            			 WHERE id = ' . $ this -> id . '' ) ; $ db -> query ( 'UPDATE articlecontent
                           SET content = "",
            				   editdate = \'' . $ this -> editdate . '\'
            			 WHERE article = ' . $ this -> id . '' ) ; } //Make dir clean (delete all files) $ this -> clearDir ( ) ; return $ this ; } return false ; }
Get Row in DB

@return bool|integer New ID or false
Get Row in DB