title: How PHP change font color of <li> element
body: <p>In PHP I need to change <code>&lt;li&gt;</code> font color when IP adress: <br>
  Is reachable = <strong>Lime</strong> font color <br>
  Not reachable = <strong>Red</strong> font color <br></p>
  
  <p>Below is code I have already tried, and it not working.</p>
  
  <p><em><strong>Main query:</strong> $stmt = $pdo -> query('SELECT ip FROM cameras');</em></p>
  
  <pre><code>echo '&lt;ul&gt;';
  while($row = $stmt -&gt; fetch()) {
      echo '&lt;li style=\'color: $color;\'&gt;'.$row['ip'].'&lt;/li&gt;';    
  }
  
  $stmt -&gt; closeCursor();
  echo '&lt;/ul&gt;';
  
  $check = $row['ip'];
  $ping = exec("ping -n 1 $check", $out, $result);
  $yes_ping = strpos($ping, 'ms');
  if($yes_ping != FALSE) {
      $color = "lime";
  } else {
      $color = "red";
  }
  </code></pre>