title: While loop only creates one dropdown box per client (PHP/MySQL)
body: <p>I am attempting to use two queries to set up multiple dropdown menus per doctor.  So far this is working, however it unfortunately pulls only the item.</p>
  
  <p>I would like to have all of the 'expertises' available within the dropdown (and the expertise IDs as the option values).</p>
  
  <p>I have set up the below while loop, however I have been unsuccessful in producing a dropdown for each Client_ID.</p>
  
  <p>The first query (below) pulls the client ID from the area </p>
  
  <pre><code>$client_id = $_GET['doc_id'];
  $physician_id_expertise = $client_id;
  
  $doctor_query = 'SELECT * ';
  $doctor_query.= 'FROM `primarycare_expertise` ';
  $doctor_query.= 'WHERE `physician_id`=' . $client_id . ' ';
  $doctor_result = mysql_unbuffered_query( $doctor_query );
  </code></pre>
  
  <p>The while loop incorporates the second query, which sets up the dropdown (pulling in all of the 'expertise' values).</p>
  
  <pre><code>while ($doctor_row = mysql_fetch_array( $doctor_result ))
  {
      echo "&lt;select name='doc_id_expertise_" . $doctor_row['pe_id'] . "' id='doc_id_expertise_" . $doctor_row['pe_id'] . "'&gt;";
  
      $expert_query = 'SELECT * FROM `expertise` ';
      $expert_result = mysql_unbuffered_query( $expert_query );
  
      while ($expert_row = mysql_fetch_array( $expert_result )){
          if($doctor_row['expertise_id'] == $expert_row['expertise_id'])
          {
              $selected = "selected";
          } else {
              $selected = "";
          }
          echo "&lt;option $selected value=" . $expert_row['expertise_id'] . "&gt;" . $expert_row['expertise'] . "&lt;/option&gt;";
      }
  
      echo "&lt;/select&gt;";
      echo "&lt;br /&gt;";
  }
  </code></pre>
  
  <p>If any of you could help me out, I would be very appreciative!  Thank you for your time!</p>