How to catch empty query in php
<p>I have several articles in my db and search on my site. if the user does not enter anything and click search, then displays all articles. How to catch empty request?</p>

<p>Code:</p>

<pre><code>&lt;?php
mysql_connect("localhost", "user", "password") or die("Error");
mysql_select_db("selv_hram") or die("Error");
mysql_query('SET names "utf8"');

if (isset($_POST['search'])) {
    $searchq = $_POST['search'];
    $searchq = htmlspecialchars($searchq);      

    $query = mysql_query("SELECT * FROM articles WHERE title LIKE '%$searchq%' OR text_article LIKE '%$searchq%'");
    $count = mysql_num_rows($query);
    $output = '';

    if ($count == 0) {
        $output = 'Nothing find';
    }else {
        while ($row = mysql_fetch_array($query)) {
            $title = $row['title'];
            $text = $row['text_article'];
            $id = $row['id'];

            $output .= '&lt;div&gt;'.$title.' '.$text.'&lt;/div&gt;';
        }
    }
}   
?&gt;

    &lt;div class="content-article"&gt;
        &lt;form name="search" action="index.php" method="post" class="search-form"&gt;
        &lt;input type="text" name="search" placeholder="search" /&gt;
        &lt;input type="submit" value="&gt;&gt;"&gt;
        &lt;?php print("$output"); ?&gt;
    &lt;/div&gt;
</code></pre>