title: Conditional PHP styling based on variable value
body: <p>I have some PHP code which executes and selects 10 rows from a SQL table. One column called <code>result</code> can hold the value of won, or loss.</p>
  
  <pre><code>if (mysqli_num_rows($result) &gt; 0) {
      while($row = mysqli_fetch_assoc($result)) {
          echo "&lt;div class = 'logrow'&gt; &lt;img src ='". $row["url"] ."'&lt;/img&gt; &lt;p class = 'logtext'&gt;". $row["name"] ." bet $". $row["amount"] ." with a ".  $row["chance"] ."% chance and ". $row["result"] .". &lt;/p&gt; &lt;/div&gt;";
      }
  </code></pre>
  
  <p>How could I do something which would echo the values from each row as above but to echo a different statement for each row where the value of <code>result</code> is loss. For example to add an inline styling for the background colour.</p>
  
  <p>So for example, say I have 10 rows found - 9 of these have <code>$row["result"]</code>as won, so they should be echoed as above. But 1 row has the value of <code>$row["result"]</code> as loss, a different echo should be applied. Perhaps with an inline style, or maybe with a variable inserted which hold this style.</p>
  
  <p>I know this is very specific and may not be clear so thanks in advance. </p>