title: PHP script working with sql query but error message not showing just blank
body: <p>Hello I have a PHP script that works as in I get the desired results but can not work out why when I put in a blank query my error message does not show instead I get all results. Can anyone shed some light on this. When an input value is entered that does not match the database the error message works it is just blank queries. I can control with javascript (validation) but would prefer if I understood whats wrong with my script. </p>
  
  <p>I have looked at over questions that suggest the use of isset( which I tried to apply but obviously not correctly. </p>
  
  <p>I was thinking of </p>
  
  <pre><code>if( isset...){
  
  post [query];
  
  }
  else{
  
  do not post ;
  </code></pre>
  
  <p>but am not applying correctly (this above is from another question) but not sure if correct. Below is my script giving the undesired behavior:</p>
  
  <pre><code>&lt;?php
  include 'config.php';
  
  $userinputone = isset($_POST['abc'])? $_POST['abc'] : false;
  
  $userinputone = mysqli_real_escape_string($con,$userinputone);
  $sql = "SELECT * FROM handover WHERE batch1number  = '".$userinputone."' OR        
  
  batch2number = '".$userinputone."' ";
  $result = mysqli_query($con,$sql);
  
  $count=mysqli_num_rows($result);
  
  if($count==0 ){
  echo "&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;p&gt; No Matching results found&lt;/p&gt;";
  }
  
  else{
  while($row = mysqli_fetch_array($result)) {
  echo "&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;select&gt;";
  echo "&lt;option&gt;" . $row['batch1number'] . $row['batch2number'] . "&lt;/option&gt;";
  echo "&lt;/select&gt;";
  }
  }
  
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>thanks in advance for your help.</p>