db::last_id PHP Method

last_id() static public method

Returns the last returned insert id
static public last_id ( ) : integer
return integer
    static function last_id()
    {
        $connection = self::connection();
        return @mysql_insert_id($connection);
    }

Usage Example

Exemplo n.º 1
0
 public function add_answer_action($params)
 {
     $a = arr::extract($params, ['question_id', 'content', 'type']);
     db::exec($this->db, "INSERT INTO i_answers (question_id, content, type) VALUES(:question_id, :content, :type)", [':question_id' => $a['question_id'], ':content' => $a['content'], ':type' => $a['type']]);
     $curr_a = db::last_id($this->db);
     $this->view->render('json', $curr_a);
 }
All Usage Examples Of db::last_id