title: foreach ($rows as $row) - changing some (not all) values
body: <p>I am trying to display some data on that I successfully extracted from an SQL database. I have two bits of data, people's name and people's nickname. </p>
  
  <p>If the person has a nickname, I want to display it in the data instead of the name. If they have no nickname I want to display the name. I tried using this bit of code but it effects all of the rows, rather than just those where the nickname field isn't empty. </p>
  
  <p>Cam anybody offer some advice? Thanks in advance.</p>
  
  <pre><code>foreach ($rows as $row)
  {
      $name = $row["name"];
      $nickname = $row["nickname"];
  
  if($row["nickname"] !== NULL)
  {
      $name = $nickname;
  }
  
      echo "&lt;tr&gt;";    
      echo "&lt;td&gt; $name &lt;/td&gt;";
      echo"&lt;/tr&gt;";
  </code></pre>