Это MariaDB 10.3.11.
Если вам интересно, при использовании LastInsertId
Если выполняется другой запрос после запроса на вставку безоговорочно возвращается 0.
пример таблицы
Код: Выделить всё
create table test
(
id int unsigned auto_increment comment 'PK' primary key,
title varchar(128) charset utf8mb4 not null comment 'title'
)
comment 'test';
create table test2
(
id int unsigned auto_increment comment 'PK' primary key,
title varchar(128) charset utf8mb4 not null comment 'title'
)
comment 'test2';
Код: Выделить всё
$this->db->beginTransaction();
$statement = $this->db->prepare('INSERT INTO test SET (title) VALUES (:title)');
$statement->bindValue(':title', 'title');
$statement->execute();
$statement2 = $this->db->prepare('UPDATE test2 SET update name = :name');
$statement2->bindValue(':name', 'test');
$statement2->execute();
$this->db->lastInsertId();
$this->db->commit();
Подробнее здесь: https://stackoverflow.com/questions/791 ... in-php-pdo
Мобильная версия