title: Using if statement when using values from the database
body: <p>I have a query that outputs the resulting data into a table. I have two fields in that table that are vital for this <code>if</code> statement: <code>Max Capacity</code> and <code>Current Capacity</code>. These are from our database, from the same table.</p>
  
  <p>I want to write an <code>if</code> statement:</p>
  
  <pre><code>if (Max_C == Current_C){
     echo "Sorry, course is full.";
  }
  else{
     $insert = mysql_query ("insert into blahblahblah... ");
  }
  </code></pre>
  
  <p>How do I do this? How do I specify the <code>max_c</code> and <code>current_c</code> from the db?</p>
  
  <p>That section of code:</p>
  
  <pre><code>if($courseandtime) {  $max_e = $courseandtime['MaxEnrollment']; $current_e = $courseandtime['COUNT(REGISTERED.SID)']; } 
  
      if ($current_e &lt; $max_e) {
          echo "
         &lt;form action='register-exec.php' method='post'&gt;
         &lt;label&gt;Time: $_POST[Time]&lt;/label&gt;&lt;br&gt;
         &lt;input type='hidden' value='$Time' /&gt;&lt;br&gt;&lt;br&gt;
         &lt;label&gt;Student ID:&lt;/label&gt;&lt;br&gt;
         &lt;input type='text' name='SUCID' id='SUCID' /&gt;&lt;br&gt;&lt;br&gt;
         &lt;label&gt;CID: $_POST[CID]&lt;/label&gt;&lt;br&gt;
         &lt;input type='hidden' name='CID' id='CID' /&gt;&lt;br&gt;&lt;br&gt;
             &lt;label&gt;SID: $row['SID']&lt;/label&gt;&lt;br&gt;
         &lt;input type='hidden' name='SID' id='SID' /&gt;&lt;br&gt;&lt;br&gt;
         &lt;button type='submit'&gt;Register&lt;/button&gt;
         &lt;/form&gt;
         ";
      }
      else {
          echo 'Sorry, were full!';
      }
  </code></pre>