title: Subquery returns more than 1 row on 2nd insert
body: <p>I have 2 tables:</p>
  
  <p>tblUser:</p>
  
  <pre><code>+------+-----------+
  |  id  |   Name    |
  +------+-----------+
  </code></pre>
  
  <p>tblItems(this table accepts multiple checkbox value depending on how many user selected):</p>
  
  <pre><code>+------+-----------+---------------+
  |  id  |  items    |    name_id    |
  +------+-----------+---------------+
  </code></pre>
  
  <p><code>name_id</code> will get the value of id in <code>tblUser</code>.<br />
  I use this code to get the value of id of <code>tblUser</code> to <code>name_id</code>:</p>
  
  <pre><code>for ($i=0; $i&lt;sizeof($checkbox);$i++){
      $sql2="INSERT INTO tbl_trainings VALUES (NULL, '".$checkbox[$i]."', (SELECT id FROM tbl_info))";
      $result2=mysql_query($sql2);
   }
  </code></pre>
  
  <p>It works fine on the first <code>INSERT</code> of data that will look like this in database:</p>
  
  <pre><code>+------+-----------+---------------+
  |  id  |  items    |    name_id    |
  +------+-----------+---------------+
  |  1   |  Bucket   |    1          |
  +------+-----------+---------------+
  |  2   |  Tree     |    1          |  
  +------+-----------+---------------+
  |  3   |  House    |    1          |
  +------+-----------+---------------+
  </code></pre>
  
  <p>But in the next or second <code>INSERT</code> of data will be an error. The error is </p>
  
  <p><strong>Subquery returns more than 1 row</strong> from the <code>mysql_error();</code></p>
  
  <p>By the way, this is the full codes:</p>
  
  <pre><code>if($_POST["Submit"]=="Submit"){
      $sql1="INSERT INTO tblUser VALUES (NULL, '$fname', '$lname')";
      $result1=mysql_query($sql1);
      for ($i=0; $i&lt;sizeof($checkbox);$i++){
      $sql2="INSERT INTO tblItems VALUES (NULL, '".$checkbox[$i]."', (SELECT id FROM tblUser))";
          $result2=mysql_query($sql2);
      }
  }
  
  if($result2 &amp;&amp; result1){
      echo"&lt;center&gt;";
      echo"&lt;h1&gt;";
      echo "SUCCESSFUL!";
      echo"&lt;/h1&gt;";
      echo"&lt;/center&gt;";
  }
  else {
      echo "ERROR". mysql_error();
  }
  </code></pre>
  
  <p>And the desired output in the database would be:</p>
  
  <pre><code>+------+-----------+---------------+
  |  id  |  items    |    name_id    |
  +------+-----------+---------------+
  |  1   |  Bucket   |    1          |
  +------+-----------+---------------+
  |  2   |  Tree     |    1          |  
  +------+-----------+---------------+
  |  3   |  House    |    1          |
  +------+-----------+---------------+
  |  4   |  Tree     |    2          |  
  +------+-----------+---------------+
  |  5   | Air plane |    2          |
  +------+-----------+---------------+
  |  6   | Bucket    |    3          |
  +------+-----------+---------------+
  </code></pre>
  
  <p>Any help would be appreciated.
  Thanks in advance.</p>