เขียนสดไม่ใช้ Framework
$conn = new PDO("mysql:host=localhost; dbname=database_name; charset=utf8", "root", "pass");
$q = $conn->prepare('INSERT INTO sell(s_topic, s_detail) VALUES (:s_topic, :s_detail);
$q->bindParam(':s_topic', $s_topic);
$q->bindParam(':s_detail', $s_detail);
$q->execute();
$last_insert_id = $conn->lastInsertId();
ใช้ Laravel Framework
$last_insert_id = DB::table('sell')->insertGetId($inputdata);
pdo = $conn->lastInsertId();
Laravel = DB::table('sell')->insertGetId($inputdata);