Please help me am not able to get the last inserted Id in medoo
Below is my code:
<?php header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET,OPTIONS,POST,PUT,DELETE'); header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept"); require 'vendor/autoload.php'; $app = new\Slim\Slim(); $app->container->singleton('db',function () use ($app) { return new medoo([ 'database_type' =>'pgsql', 'database_name' =>'emergency', 'server'=>'localhost', 'username' =>'postgres', 'password' => 'root', 'charset' => 'utf8', 'option' =>[ PDO::ATTR_CASE=>PDO::CASE_NATURAL ] ]); }); $app->db->post('/getinfo',function() { $body = $app->request->post(); $app->db->insert("emergencymessages", [ "message" =>$body["msg"], "createdby"=>$createdby ]); });
Now i want to get last inserted id of emergencymessages table how can i get it??