Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Get the last inserted row's primary key in php

i'm working on php and i want insert something in my sql data-base and get the row's inserted primary key in the same time so i've done something like this to insert

$SQL = "INSERT INTO `saisie` (`sid`, `reference`) VALUES (NULL,?)";
$set = $db->prepare($SQL);
$result = $set->execute(array($refCode));

but i don't know what to do to get the sid of that inserted row

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

you could use this to get the last inserted ID

$id = mysqli_insert_id($db); or
$id = $db->mysqli_insert_id(); or
$id = $db->lastInsertId();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!