title: How to know that if a table is empty or not?
body: <p>I'm developing a custom management system with php &amp; mysql and till now I have made the admin panel for inserting posts into the site template but I want to show the users that if the table of <code>blog_posts</code> is empty ,echo out <em>empty</em> for example &amp; if not then retrieve the data of table &amp; show them to users.</p>
  
  <p>Here's my <strong>blog_posts.php</strong> page which shows the posts of the table to users:</p>
  
  <pre><code>&lt;div id="box"&gt;
    &lt;div class="BJadidBold"&gt;
      &lt;h1&gt;&lt;?php echo $title; ?&gt;&lt;/h1&gt;
      &lt;p&gt;&lt;?php echo $content; ?&gt;&lt;/p&gt;&lt;/br&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And this my <strong>php_parsers.php</strong> which I have included it:</p>
  
  <pre><code>$select_posts = "select * from posts";
  $run_posts = mysqli_query($con,$select_posts);
  while($row=mysqli_fetch_array($run_posts)){
      $id = $row['post_id'];
      $title = $row['post_title'];
      $date = $row['post_date'];
      $author = $row['post_author'];
      $image = $row['post_image'];
      $keywords = $row['post_keywords'];
      $content = $row['post_content'];
  }
  </code></pre>
  
  <p>When I have not inserted any posts from my admin panel ,the blog_posts page will show this notice:</p>
  
  <blockquote>
    <p>undefined variable: title ...</p>
  </blockquote>
  
  <p>How to know whether the table is empty or not &amp; if it's empty do something else instead of printing data!</p>