title: Updating field in Database with if else statement
body: <p>I am working on recieveing an item from another application with the use of $_POST and I am trying to see if that item already exists in the database. If it does, then $count increases by one. If it does not exist in the database, then it will added in with the use of INSERT INTO.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
     date_default_timezone_set('Asia/Manila');
     $today = date('m-d-Y');
     echo $today;
  
     $con= mysqli_connect("******","******","******") 
         or die ('Error: ' . mysql_error()); 
     mysqli_select_db($con,"a3656574_opacmin");
     $sql= "SELECT keyWord FROM searchedWords";
     $result= mysqli_query($con,$sql);
  
     if($result==$_POST[keyWord])
     {
         $upD="UPDATE searchedWords SET countr = countr + 1";
            while (!mysqli_query($con,$upD))
          {
           die('Error: ' . mysqli_error($con));
          }
     }
     else
     {
        $insertIn="INSERT INTO `searchedWords`( `keyWord`, `countr`) values ('$_POST[keyWord]',1)";
      while (!mysqli_query($con,$insertIn))
          {
           die('Error: ' . mysqli_error($con));
          }
     }
  ?&gt;
  </code></pre>
  
  <p>I don't know what's wrong. No items are sent to the database at all. Does anyone know how to fix it?</p>