title: MySQL inline if statement
body: <p>I have a query that selects the name, description, date, etc of an item from a single table. This table has a field named "archived". If a row has a 1 in the archived field, it means that it's archived.</p>
  
  <p>I currently use this code here to display my list of items, whether it's archived or not:</p>
  
  <pre><code>&lt;?php
          // Request the text for zz
          $result = @mysql_query("SELECT oc_sysitem,oc_item,oc_itemdesc,oc_genre,oc_star,oc_alttxt,oc_iearchived,oc_url FROM catalog WHERE oc_sysitem LIKE('zz') ORDER BY oc_sysitem DESC, oc_item, oc_setnum +0 ASC");
  
          if (!$result) {
              exit('&lt;p&gt;Error performing query: ' . mysql_error() . '&lt;/p&gt;');
          }
          //creating the table w/ headers
          echo '
          &lt;table cellpadding="3px"&gt;
          &lt;tr&gt;
              &lt;td style="width:360px;font-weight:bold"&gt;&lt;p&gt;Title&lt;/p&gt;&lt;/td&gt;
              &lt;td style="width:90px;font-weight:bold"&gt;&lt;p&gt;Genre&lt;/p&gt;&lt;/td&gt;
              &lt;td style="width:70px;font-weight:bold"&gt;&lt;p&gt;System&lt;/p&gt;&lt;/td&gt;
              &lt;td style="width:51px;font-weight:bold"&gt;&lt;p&gt;Rating&lt;/p&gt;&lt;/td&gt;
          &lt;/tr&gt;';     
          // Display each zz
          while ($row = mysql_fetch_array($result)) {
          echo '
          &lt;tr title="' . $row['oc_item'] . ' ' . $row['oc_itemdesc'] . ', ' . $row['oc_alttxt'] . '" class="tblhover"&gt;
              &lt;td style="width:360px"&gt;&lt;a href="' . $row['oc_url'] .'" rel="nofollow"&gt;' . $row['oc_item'] . ' ' . $row['oc_itemdesc'] . '&lt;/a&gt;&lt;/td&gt;
              &lt;td style="width:90px"&gt;' . $row['oc_genre'] . '&lt;/td&gt;
              &lt;td style="width:70px"&gt;' . $row['oc_sysitem'] . '&lt;/td&gt;
              &lt;td style="width:51px"&gt;&lt;img src="../../media/ocdb/' . $row['oc_star'] . '" alt="' . $row['oc_alttxt'] . '" title="' . $row['oc_alttxt'] . '" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          ';
          }       
          echo '&lt;/table&gt;';        
          ?&gt;
  </code></pre>
  
  <p>I want to be able to display an asterisk next to the title if it is archived. I have not been able to figure out how to add an if statement or if that right path to take. Any advice would be welcomed, thank you.</p>