title: INSERT INTO table name with both variables and SELECT FROM
body: <p>I'm trying to insert an item into a table using both posted variables and something from another table. I'm not quite sure where I am going wrong because nothing is being added to the table. I'm super confused. Here is my code:</p>
  
  <pre><code>$stmt = $conn-&gt;prepare("INSERT INTO Student_Choices (Username,T1_Choice,T2_Choice,T3_Choice,Current_DB)
                        VALUES (:username,:t1choice,:t2choice,:t3choice, db.DB)
                        SELECT DB FROM Current_DB as db
                        ");
  $stmt-&gt;bindParam(':username', $_SESSION['username']);
  $stmt-&gt;bindParam(':t1choice', $_POST["term1sport"]);
  $stmt-&gt;bindParam(':t2choice', $_POST["term2sport"]);
  $stmt-&gt;bindParam(':t3choice', $_POST["term3sport"]);
  $stmt-&gt;execute();
  </code></pre>