title: How to know the ID of an auto incremented column in a "one to many" database?
body: <p>I have a database consists of 2 tables with "one to many" relationship</p>
  
  <pre><code>the first table:
  
  CREATE TABLE data (
    personid int not null auto_increment,
    name varchar(255),
    phone int ,
    primary key (personid)
  )
  </code></pre>
  
  <p>The second table:</p>
  
  <pre><code>CREATE TABLE links (
    linkid int not null auto_increment,
    link varchar(255),
    personid int,
    primary key (linkid),
    foreign key (personid)
      references data(personid)
  
  )
  </code></pre>
  
  <p>I insert records to the first table and each new record gets a new ID , Then enter links to this ID , I want to know how to know the ID of the person to insert the links to him via php/sql </p>