Subject Re: creating unique key : usingprimair key and foreign key
From Ronnie MacGregor <No_Sp@m.Thanks>
Date Sat, 6 Feb 2021 19:30:50 -0000
Newsgroups dbase.getting-started

In article <hZjyQaL$WHA.1872@ip-AC1E04A7>, dbase@nospam.goldenstag.net
says...

> I have had to do something along those lines in some of my own code on
> the web for applications when I needed the primary key right after the
> record was saved.

The following should be multiuser and session proof in PHP.
We don't have the same luxury with dbf AutoInc . . .

<?php

$myConn = new mysqli("localhost", "UserName", "Password");

$query = "INSERT INTO myTable VALUES (
  'Text',
  'MoreText',
  'Something',
  'Something Else'
  )";

$myConn->query($query);

$NewRecordID = $myConn->insert_id;

?>