title: PHP & MySql check if table is empty
body: <p>I'm a bit of a noob- and I'm having a hard time...</p>
  
  <p>I need a bit of of code that searches a db table to find the row that matches the $id variable. There's a field in that table 'description' that I need to grab. If it's null, I need to show one message, if not another. Here's the code I have (I know I need to add the mysqli escape string, just doing this real quick from memory):</p>
  
  <pre><code>$query = "SELECT description FROM posts WHERE id = $id";
  $result = mysqli_query($dbc, $query);
  
  $row = mysqli_fetch_array($result, MYSQLI_ASSOC) ;
  
  if(!$row){
  echo "&lt;p&gt;'No description'&lt;/p&gt;";
  } else {
  echo '&lt;p&gt;' . $row['description'] . '&lt;/p&gt;';
  }
  </code></pre>