title: php - Undefined variable: stmt in
body: <p>I'm fairly new in php .I get at line ($stmt->bindParam(":e1", $_POST['eidosmetaf1']);) error "Undefined variable: stmt in" .It seems to be a basic mistake but i can't figure it out. So any help is appreciated</p>
  
  <pre><code>&lt;?php
  
  require("config.inc.php");  
  
      $query = "UPDATE customer SET ";
  if(isset($_POST['eidosmetaf1'])){ 
  $stmt-&gt;bindParam(":e1", $_POST['eidosmetaf1']);
    $query .= "eidosmetaf1 = :e1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['weight1'])){  
  $stmt-&gt;bindParam(":w1", $_POST['weight1']);
    $query .= "weight1 = :w1";
  }
  
      $query = "UPDATE customer SET ";
  if(isset($_POST['startNomos1'])){ 
  $stmt-&gt;bindParam(":sn1", $_POST['startNomos1']);
    $query .= "startNomos1 = :sn1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['startPoli1'])){ 
  $stmt-&gt;bindParam(":sc1", $_POST['startPoli1']);
    $query .= "startPoli1 = :sc1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['start_lat'])){ 
  $stmt-&gt;bindParam(":slat1", $_POST['start_lat']);
    $query .= "start_lat = :slat1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['start_lng'])){ 
  $stmt-&gt;bindParam(":slng1", $_POST['start_lng']);
    $query .= "start_lng = :slng1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['finalNomos1'])){ 
  $stmt-&gt;bindParam(":fn1", $_POST['finalNomos1']);
    $query .= "finalNomos1 = :fn1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['finalPoli1'])){  
  $stmt-&gt;bindParam(":fc1", $_POST['finalPoli1']);
    $query .= "finalPoli1 = :fc1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['final_lat'])){  
  $stmt-&gt;bindParam(":flat1", $_POST['final_lat']);
    $query .= "final_lat = :flat1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['final_lng'])){  
  $stmt-&gt;bindParam(":flng1", $_POST['final_lng']);
    $query .= "final_lng = :flng1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['depDate1'])){  
  $stmt-&gt;bindParam(":dD1", $_POST['depDate1']);
    $query .= "depDate1 = :dD1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['depTime1'])){ 
  $stmt-&gt;bindParam(":dT1", $_POST['depTime1']);
    $query .= "depTime1 = :dT1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['specialservices1'])){  
  $stmt-&gt;bindParam(":ex1", $_POST['specialservices1']);
    $query .= "specialservices1 = :ex1";
  }
  
  $query = "UPDATE customer SET ";
  if(isset($_POST['comments1'])){  
  $stmt-&gt;bindParam(":c1", $_POST['comments1']);
    $query .= "comments1 = :c1";
  }
  
  
      try {
          $stmt = $db-&gt;prepare($query);
         $stmt-&gt;execute();
      }
      catch (PDOException $ex) {
  
          $response["success"] = 0;
          $response["message"] = "Database Error2. Please Try Again!";
          die(json_encode($response));
      }    
  
      $response["success"] = 1;
      $response["message"] = "..............!";
      echo json_encode($response); 
  
  
  ?&gt;
  </code></pre>