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

Get insert_id in v4? #181

Closed
carlo-fontanos opened this issue Feb 13, 2020 · 2 comments
Closed

Get insert_id in v4? #181

carlo-fontanos opened this issue Feb 13, 2020 · 2 comments
Labels

Comments

@carlo-fontanos
Copy link

@carlo-fontanos carlo-fontanos commented Feb 13, 2020

Hi,

In previous versions, I can access the insert_id like this: $db->insert_id;

But in version 4, I am getting the error:

 Uncaught Error: Cannot access protected property ezsql\Database\ez_mysqli::$insert_id

Please help.

@techno-express
Copy link
Contributor

@techno-express techno-express commented Feb 13, 2020

You are getting the correct error, they protected, no direct public access, try $db->getInsertId();.

It's a magic method to access any of the method properties. Prefix either get or set, and remove _.

UPDATE after reviewing of the code, it's a @todo about removing _, implementing it now is BC, and the tests needs updating.

So try $db->getInsert_Id()

@carlo-fontanos
Copy link
Author

@carlo-fontanos carlo-fontanos commented Feb 14, 2020

Thanks, that worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.