title: how to select id from one table and insert into other table
body: <pre><code> $select = "SELECT MAX(order_id) FROM `order`";
         mysql_query($select);
  
  
     foreach ($_COOKIE['item'] as $key12 =&gt; $value) {
          $value22 = explode("__", $value);
  
          $query1 = "INSERT INTO `cart`(`cart_id`, `product_id`, `order_id`, `Quantity`, `total_price`) VALUES ('',$value22[5],'$select','$value22[3]','$value22[4]')";
          $result2 = mysql_query($query1);
  </code></pre>
  
  <p>The output of this is <code>SELECT MAX(order_id) FROM order</code>, so what is the solution of this selection and insertion of the id</p>