Answer the question
In order to leave comments, you need to log in
How to assign an inserted id during an INSERT query?
if (!isset($_SESSION['uid'])) {
$this->pdo('insert into users set login = ?', [
// сюда нужно вставить значение 'Пользователь-айди_под_которым_вставлена_строка'
]);
$_SESSION['uid'] = $this->connection->lastInsertId(); // с этим как раз-таки всё понятно
}
Answer the question
In order to leave comments, you need to log in
Analogues lastInsertId()
Get current auto increment value from information_schema or via TABLE STATUS
SELECT LAST_INSERT_ID();
SELECT AUTO_INCREMENT
FROM information_schema.tables
WHERE table_name = 'table_name'
AND table_schema = DATABASE( ) ;
SHOW TABLE STATUS LIKE 'table_name'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question