title: Search Using PHP displays all Database Data
body: <p>I am trying to search some data from a database. The search works fine, however if I click on search without entering anything into the form, it displays all the data on the database. Anyway I can fix this?</p>
  
  <p>This is my php code.</p>
  
  <pre><code>$link=mysqli_connect("localhost","root","");
  // Check connection
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  
  $db_selected = mysqli_select_db($link,"AnimalTracker1");
  
  if (!$db_selected)
    {
    die ("Can\'t use test_db : " . mysqli_error($link));
    }
  $searchKeyword = $_POST['find']; // Sanitize this value first !!
     $sql=mysqli_query($link, "Select * FROM Locations WHERE `Animal_Type` LIKE '%$searchKeyword%' ");
  
  
  
  if ($sql == FALSE)
  {
    die($sql." Error on query: ".mysqli_error($link)); 
   }
  
  while($result = mysqli_fetch_array($sql))
  {
  echo  $result ['Animal_Type'];
  echo "&lt;br&gt;";
  echo $result ['Latitude'];
  echo "&lt;br&gt; ";
  echo $result ['Longitude'];
  echo " &lt;br&gt;";
  echo $result ['Seen'];
  echo " &lt;br&gt; ";
  echo $result ['Time'];
  echo "&lt;br&gt; ";
  echo "&lt;br&gt; ";
  }
  //}
  ?&gt;
  </code></pre>