Skip to content

lastInsertId error #44

@facu-alba

Description

@facu-alba

Hi @mychidarko how are you? I need help. I have problem with the lastInsertId() function. Always it returns 0.

db()->insert("{$this->dbName}.{$table}")->params($params)->execute(); $lastInsertId = db()->query("SELECT LAST_INSERT_ID();")->fetchAll(); dd($lastInsertId); return (int) $lastInsertId;

Also return 0 if i do:

db()->lastInsertId()

Image

But in pure mysql works:

INSERT INTO event_place_mappings (event_id, place_id) VALUES (56, 33); SELECT LAST_INSERT_ID();

Image

mysql Ver 9.3.0 for Linux on x86_64 (MySQL Community Server - GPL)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions