title: Using the ternary operator in php to echo different statuses based on an event status in sql
body: <p>Well if the status is 1 it's "Active Insurance Event" and if 2 it's "Completed Insurance Event".     </p>
  
  <pre><code>if(!empty($ins_event))
              {
              echo "&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;img src='/check-icon.gif'&gt; &lt;a href='". matry::here(array('event_id'=&gt;$ins_event['id'])) . "'&gt;" . ( $ins_event['status'] == 2 ? "Completed Insurance Event": "Active Insurance Event") . "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;"; 
              }
  else 
          {
          echo "&lt;tr&gt;&lt;td&gt;" . cbox_return() . "&lt;a href='". matry::here_to('new', array('tfilt'=&gt;'IN', 'pfilt'=&gt;$patient-&gt;code)) . "' style='color: #000; color:$rx_image_color'&gt;**Ins Event Not Created**&lt;/td&gt;&lt;/tr&gt;";
          }
  </code></pre>
  
  <p>I have a variable for color here:</p>
  
  <pre><code>&lt;?php
  $rx_event_colors = $rx_ev_status = '#009933';
  ?&gt;
  </code></pre>
  
  <p>How can i use this variable to grab the status of 2 and change the font color.</p>
  
  <p>Should i break up the script and use if {} else {} statements?</p>
  
  <hr>
  
  <p>updated code:</p>
  
  <pre><code>echo "&lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;img src='/check-icon.gif'&gt; &lt;a href='". matry::here(array('event_id'=&gt;$ins_event['id'])) . "'" . ( $ins_event['status'] == 2 ? ' style="color: ' . $rx_ev_status . '"&gt;Completed Insurance Event' : '&gt;Active Insurance Event') . "&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;"; 
  </code></pre>