title: Why is Php throwing this error?
body: <p>Trying to allow php to pull the 'code' and 'prefix' fields using the same variable query.</p>
  
  <p>Error: Not showing values for <code>'code'</code></p>
  
  <pre><code>   &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $("#ProfFields,#courseFields").hide();
          $("input:radio[name='addType']").click(function(){
            var profFields = ($(this).val()=="Professor");
            $("#ProfFields").toggle(profFields); 
            $("#courseFields").toggle(!profFields);
       });
      });
      &lt;/script&gt;
      &lt;?php
      require_once('inc/dbc1.php');
      $pdo = new PDO('mysql:host=ureviewdu.db.6511651.hostedresource.com;dbname=ureviewdu', $username, $password);
      $pdo-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
      $sth = $pdo-&gt;prepare('
          SELECT name
          FROM Department
          ;');
      $sth-&gt;execute(array());
  
      $pdo2 = new PDO('mysql:host=####;dbname=###', $username, $password);
      $pdo2-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
      $sth2 = $pdo2-&gt;prepare('
          SELECT prefix, code FROM Course
          ;');
      $sth2-&gt;execute(array());
      ?&gt;
      &lt;div id="popup_name" class="popup_block"&gt;
          &lt;h2 style="padding:0; margin:0;"&gt;Add a:&lt;/h2&gt;&lt;br&gt;
          &lt;form action="inc/add_p_c_validate.php" method="post" id="addition"&gt; 
              Professor&lt;input type="radio" name="addType" value="Professor" /&gt;
              &amp;nbsp;&amp;nbsp;Course&lt;input type="radio" name="addType" value="Course" /&gt; 
  
              &lt;div id="courseFields"&gt;
  
                       Course[Prefix]: &lt;select name="cPrefix" id="cPrefix" style="width:150px;" /&gt; 
                      &lt;?php while($row2 = $sth2-&gt;fetch(PDO::FETCH_ASSOC)) {echo "&lt;option&gt;".$row2['prefix']." "."&lt;/option&gt;&lt;br&gt;";} ?&gt; &lt;/select&gt;
  
                      Course[Code]: &lt;select name="cCode" id="cCode" style="width:150px;" /&gt; 
                      &lt;?php while($row2 = $sth2-&gt;fetch(PDO::FETCH_ASSOC)) {echo "&lt;option&gt;".$row2['code']." "."&lt;/option&gt;";} ?&gt;&lt;/select&gt; 
  
                  Department: &lt;select name="deptName" id="deptName" style="width:350px;"&gt;
                      &lt;?php while($row = $sth-&gt;fetch(PDO::FETCH_ASSOC)) {echo "&lt;option&gt;".$row['name']." "."&lt;/option&gt;";} ?&gt;&lt;/select&gt;   
                  Email: &lt;input type="text" name="email"  class="l" /&gt;
               &lt;/div&gt;&lt;!--/courseFields--&gt;
               &lt;div id="ProfFields"&gt;
               &lt;br&gt;First Name: &lt;input type="text" name="name" style="width:385px;" /&gt;&lt;br&gt;
               &lt;br&gt;Last Name: &lt;input type="text" name="name" style="width:385px;" /&gt;&lt;br&gt;
                Department: &lt;select name="deptName" id="deptName" style="width:350px;"&gt;   
               &lt;/div&gt;&lt;!--/ProfFields--&gt;
              &lt;input type="submit" name="submit" /&gt; 
          &lt;/form&gt; 
      &lt;/div&gt;&lt;!--popup_name--&gt;
  </code></pre>