title: changing font color of data from database using php
body: <p>I am new to MySQL an PHP and not sure how to do this.</p>
  
  <p>I am displaying:</p>
  
  <pre><code>&lt;?php echo "$cash"; ?&gt;
  </code></pre>
  
  <p>on my page. Which works just fine.</p>
  
  <p>What I would like to do is,
  if it is a negative number I would like the number to be red
  if it is a positive number I would like the number to be green
  the font color that is.</p>
  
  <p>Any help would be appreciated, thank you.</p>
  
  <pre><code>&lt;?php $class = ($cash &lt; 0) ? 'red' : 'green' ?&gt;
  
  &lt;p class="&lt;?php echo $class; ?&gt;"&gt; &lt;?php echo $cash; ?&gt; &lt;/p&gt;
  
  &lt;style&gt;
  .red { color: red }
  .green { color: green }
  &lt;/style&gt;
  </code></pre>
  
  <p>this works, but i would like the '$' to be included.
  Example:</p>
  
  <p>-$100<br />
  $100</p>