title: how to use select statement with form data in where condition to insert data into database
body: <p>i have a code to insert data in mysql which is inserting multiple rows to the database from form successfully. but i want to use a select statement which will fetch data from other table  using where condition. 
  here is my post code.</p>
  
  <pre><code>&lt;?php
  include('mysql.php');
  require("dbconn.php");
  
   if (isset($_POST['submit']))
      {
          $stockid = $_POST["series"];
          $desc = $_POST["season"];
          //$price = $row['price']; - remove
          foreach($stockid as $a =&gt; $B)
          {
  
      mysql_query("INSERT INTO 0_stock_master (stock_id, description) VALUES ('$stockid[$a]','$desc[$a]')");
  } 
  }
  ?&gt;
  </code></pre>
  
  <p>now i want to use this code to fetch data and insert in to above query for all rows....</p>
  
  <pre><code> $result = mysql_query("SELECT description FROM 0_stock_category where category_id = '".$_POST["series"]."'", $con);
      while($row = mysql_fetch_array($result9))
      {
       $code = $row['description'];
      }
  </code></pre>
  
  <p>Please tell me how to use above code how to put this code in my post data......
  my insert statement may look like this</p>
  
  <pre><code>mysql_query("INSERT INTO 0_stock_master (stock_id, description, code) VALUES ('$stockid[$a]','$desc[$a]','$code[$a]')");
  </code></pre>