title: postgresql equivalent to $mysqli->insert_id
body: <p>Is there an equivalent to  $mysqli->insert_id in postgresql 9.3? I am importing into one table, but I need to take the last primary key created in the table and apply it as a foreign key in the second table? Table 1 ----> Table 2 to complete a record.</p>
  
  <p>A bit more info:</p>
  
  <pre><code>$sql = "INSERT INTO sheet_tbl (site_id,  eventdate) VALUES ('$_POST[site_id]','$_POST[eventdate]') returning id";
  </code></pre>
  
  <p>**Using the sql above, i insert my record, how would I then utilise this in my next SQL insert, If i use returning id, where is this ID stored, How do I use it on another INSERT statement?</p>
  
  <pre><code> $sql1 = "INSERT INTO record_tbl (line, taxom_id, number_of_taxom, sheet_id) VALUES (1,1,'$_POST[cased_numbers]','$_POST[sheet_id]')";
    $result = pg_query($sql1);
  </code></pre>