mysql get last inserted id
snippet in sql

mysql get this inserted id php

user8427

$this_id = mysqli_insert_id($db);

mysql get last inserted id

user8657

-- 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;

find last id

user9891

//laravel controller
$newOrder = new Order();
...
...
$newOrder->save();

$last_id = $newOrder->id;