Mysql ID der eingefügten Zeile
-- For mysql
INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();
Caleb McNevin
-- For mysql
INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();
SELECT MAX(id) AS last_id FROM users
-- last_id --
-- 33 --
SET @last_id = LAST_INSERT_ID();
-- To get the last inserted auto-increment row ID: --
SELECT LAST_INSERT_ID( optional_expression )
-- If you have just inserted it using a command in C# use: --
int lastId = (Int32)yourCommand.LastInsertedId;
mysql> select *from LastInsertedRow where Id=(SELECT LAST_INSERT_ID());
//laravel controller
$newOrder = new Order();
...
...
$newOrder->save();
$last_id = $newOrder->id;