title: MySQL returning an empty field: CONCAT(nonEmpty1,empty2,nonEmpty3) = NULL
body: <p>I have PHP 5 code accessing a MyISAM table on MySQL 5 server. The query looks like this:</p>
  
  <pre><code>SELECT CONCAT(fName1,' ',mName2,' ',lName3) AS userName 
      FROM users 
      WHERE level &gt; 10
  </code></pre>
  
  <p>When there's no mName filled in, <strong>I am expecting output like "fname  lname" , but I'm getting "" (empty string) instead</strong> (the number of rows returned is correct). Where am I making a mistake? </p>
  
  <p>PHP code:</p>
  
  <pre><code>&lt;?php
  $result = mysql_query($the_above_query);
  while ($result_row = mysql_fetch_assoc($result)) {
      // do stuff with the name
      // except I'm getting empty strings in $result_row['userName']
  }
  </code></pre>
  
  <p>Relevant part of table structure:</p>
  
  <pre><code>CREATE TABLE users {
      /* -snip- */ 
      `fName1` varchar(50) default NULL,      
      `mName2` varchar(50) default NULL,      
      `lName3` varchar(50) default NULL,      
      `level` int(11) default 0,      
      /* -snip- */ 
  } ENGINE=MyISAM DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>(also, is this way (column concatenation in MySQL) a good idea, or should I fetch the columns to PHP and join them there?)</p>
  
  <hr>
  
  <p>Turns out that I was getting back a NULL; PHP treats a returned NULL and empty string("") similarly, you'd have to compare with === to see the difference.</p>