title: How to check if MySQL returns null/empty?
body: <p>In DB I have a table with a field called <code>fk_ownerID</code>. By default, when I add a new table row, the <code>fk_ownerID</code> is empty. In Toad for MySQL, this is shown as <code>{null}</code>. If <code>fk_ownerID</code> is given a value, and I later remove this value, I set <code>fk_ownerID = ""</code>.</p>
  
  <p>Now, I have the following code:</p>
  
  <pre><code>$result = $dal-&gt;getRowByValue('tableName','id', $_POST['myID']);
  
  // Check to see if any rows where returned
  if (mysql_num_rows($result) &gt; 0)
  {
    while ($row = mysql_fetch_array($result))
    {
      $ownerID = $row["fk_ownerID"];    
    }
  }
  </code></pre>
  
  <p>Now the variable $ownerID should have a number, or not. But I'm unsure how to check this. Currently I'm doing this:</p>
  
  <pre><code>if ( (strlen($ownerID) == 0) || ($ownerID == '0') || ($ownerID == 'null') )
  </code></pre>
  
  <p>But I'm pretty sure only one of these tests should be necessary.</p>
  
  <p>What is the best way to check if a row field is empty or null?</p>