title: What is equivalent of mysql_insert_id(); using prepared statement?
body: <p>I have used prepared statement to insert an order into an orders table but now I want to insert the order items into the order items table based on the last ID inserted in the orders table:</p>
  
  <pre><code>if (isset($_POST['process'])) {
  
      $order_name = $_POST['order_name'];
      //create initial order
      $stmt = $conn2-&gt;prepare("INSERT INTO orders (order_name) VALUES (?)");
      $stmt-&gt;bind_param('s', $order_name);
      $stmt-&gt;execute();
  
      //this gets the most recent auto incremented ID from the database - this is the order_id we have just created
      $order_id = mysql_insert_id();
  
      //loop over all of our order items and add to the database
      foreach ($_SESSION['order'] as $item) {
  </code></pre>
  
  <p>What is equivalent to <code>mysql_insert_id();</code> using prepared statement?</p>