title: Fail to update the data in database
body: <p>I try to update the data in the database, but when I run the code, there is no error message appear, looks like its a logical error but I still don't have any clue about what is happening with my code. </p>
  
  <p>Here is the code</p>
  
  <pre><code> &lt;?php
  
      include("conn.php");
      SESSION_START();
      if($_SESSION["loggedin"]!="true"&amp;&amp; $_SESSION['login'] != '')
          header("location:login.php");
      $aid = $_SESSION["usr"];
      $result = mysql_query("select r.CustomerID from customer c inner join results r on r.CustomerID = c.CustomerID where c.Username = '".$aid."' ");
  
      if (false === $result) {
      echo mysql_error();
      }
      $row = mysql_fetch_assoc($result);
  ?&gt;
  
  &lt;?php
  if (isset($_POST["submitbtn"]))
  {
      $bookid = $_POST["bookid"];
      $LP = $_POST["LP"];
      $budget = $_POST["budget"];
      $smokep = $_POST["SmokeP"];
      $spreq = $_POST["sp_req"];
          $query = mysql_query("UPDATE `results` SET LP = '$LP', budget = '$budget', SmokeP = '$smokep', sp_req = '$spreq' 
                                  WHERE results.BookID = '".$bookid."' and results.CustomerID = '".$result."'");  
  
          if (false === $query) 
          {
              echo     mysql_error();
          }
  
          ?&gt;
          &lt;script type = "text/javascript"&gt;
                  alert("Amendment Saved!!");
          &lt;/script&gt;
          &lt;?php
  
  }
  ?&gt;
  </code></pre>
  
  <p>Is the error coming from the select query? Or the if statement for the submitbtn went wrong?</p>