Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert execute no longer return new id #145

Closed
Rettiwer opened this issue Jun 16, 2021 · 1 comment
Closed

Insert execute no longer return new id #145

Rettiwer opened this issue Jun 16, 2021 · 1 comment
Milestone

Comments

@Rettiwer
Copy link

Rettiwer commented Jun 16, 2021

        $a = $pdo->insert()
                            ->into("table")
                            ->columns('x', 'y')
                            ->values($x, $y);

        $insertId = $a->execute();

returns

object(PDOStatement)#106 (1) {
["queryString"]=>
string(66) "INSERT INTO table (x, y) VALUES (?, ?)"
}

instead of new id, how to get it in 2.1 version?

@kwhat
Copy link
Collaborator

kwhat commented Nov 2, 2021

I have updated the docs, it should be $insertId = $a->execute()->lastInsertId();

@kwhat kwhat closed this as completed Nov 2, 2021
@kwhat kwhat added this to the v2.2.0 milestone Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants