title: Warning in PDOStatement: Invalid parameter number
body: <p>Maybe you can help me with this part of my code. I tried to make it works, but when I try to <code>UPDATE</code> always show me this error:</p>
  
  <blockquote>
    <p>Warning: PDOStatement::execute() [pdostatement.execute]:
    SQLSTATE[HY093]: Invalid parameter number: number of bound variables
    does not match number of tokens in
    /home/-----/public_html/soft/Admin/configuracion.php on line 264</p>
  </blockquote>
  
  <p>the line 264 is:</p>
  
  <pre><code>// Execute the query
              $stmt-&gt;execute();
  </code></pre>
  
  <p>Below of: </p>
  
  <pre><code> $stmt-&gt;bindParam(':page_meta_tag', $_POST['page_meta_tag']);
     $stmt-&gt;bindParam(':id', $_POST['id']);
  </code></pre>
  
  <hr>
  
  <p>Here is my code:</p>
  
  <pre><code>    &lt;?php
  include '../include/update_config.php';
  
  $conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
  
  $action = isset( $_POST['action'] ) ? $_POST['action'] : "";
  if($action == "update"){
          try{
               $query = "update CONFIGURACION set id = :id, nombre_clinica = :nombre_clinica, direccion = :direccion, telefono_clinica = :telefono_clinica, titulo_clinica = :titulo_clinica, logo = :logo, page_meta_tag = page_meta_tag where id = 1";
  
                  $stmt = $conn-&gt;prepare($query);
  
                  $stmt-&gt;bindParam(':nombre_clinica', $_POST['nombre_clinica']);
                  $stmt-&gt;bindParam(':direccion', $_POST['direccion']);
                  $stmt-&gt;bindParam(':telefono_clinica', $_POST['telefono_clinica']);
                  $stmt-&gt;bindParam(':titulo_clinica', $_POST['titulo_clinica']);
                  $stmt-&gt;bindParam(':logo', $_POST['logo']);
                  $stmt-&gt;bindParam(':page_meta_tag', $_POST['page_meta_tag']);
                  $stmt-&gt;bindParam(':id', $_POST['id']);
  
                  // Execute the query
                  $stmt-&gt;execute();
  
                  echo "Record was updated.";
  
          }catch(PDOException $exception){ //to handle error
                  echo "Error: " . $exception-&gt;getMessage();
          }
  }
  
  try {
  
          //prepare query
          $query = "select nombre_clinica, direccion, telefono_clinica, titulo_clinica, logo, page_meta_tag from CONFIGURACION where id = 1";
          $stmt = $conn-&gt;prepare( $query );
  
          //this is the first question mark
          $stmt-&gt;bindParam(1, $_REQUEST['id']);
  
          //execute our query
          $stmt-&gt;execute();
  
          //store retrieved row to a variable
          $row = $stmt-&gt;fetch(PDO::FETCH_ASSOC);
  
          $id = $row['id'];
          $nombre_clinica = $row['nombre_clinica'];
          $direccion = $row['direccion'];
          $telefono_clinica = $row['telefono_clinica'];
          $titulo_clinica = $row['titulo_clinica'];
          $logo = $row['logo'];
          $page_meta_tag = $row['page_meta_tag'];
  
  }catch(PDOException $exception){ //to handle error
          echo "Error: " . $exception-&gt;getMessage();
  }
  
  
  ?&gt;
              &lt;form class='form-horizontal' method='post' action='' enctype='multipart/form-data'&gt;
                  &lt;fieldset&gt;
                  &lt;legend&gt;&lt;i class='icon32 icon-wrench'&gt;&lt;/i&gt;Configuración General del Sistema&lt;/legend&gt;
  
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Nombre de la Clínica&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input type='text' class='span6 typeahead' name='nombre_clinica' 
                              value='&lt;?php echo $nombre_clinica;  ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Dirección&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input type='text' class='span6 typeahead' name='direccion' 
                              value='&lt;?php echo $direccion;  ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Número de Teléfono&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input type='text' class='span6 typeahead' name='telefono_clinica' 
                              value='&lt;?php echo $telefono_clinica; ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Viñeta de página web&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input type='text' class='span6 typeahead' name='titulo_clinica' 
                              value='&lt;?php echo $titulo_clinica; ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Logo Clínica&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input class='input-file uniform_on' id='fileInput' name='logo' type='file' /&gt;
                          &lt;br /&gt;
                          &lt;img style='max-height:80px;' src='../images/&lt;?php echo $logo; ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;label class='control-label' for='typeahead'&gt;Meta tag del Software clínico&lt;/label&gt;
                      &lt;div class='controls'&gt;
                          &lt;input type='text' class='span6 typeahead' name='page_meta_tag' 
                              value='&lt;?php echo $page_meta_tag; ?&gt;' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class='control-group'&gt;
                      &lt;div class='controls'&gt;
                  &lt;input type='hidden' name='id' value='&lt;?php echo $id ?&gt;' /&gt;&lt;input type='hidden' name='action' value='update' /&gt;
                  &lt;input type='submit' class='btn btn-primary' value='Actualizar configuracion' /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;/fieldset&gt;
               &lt;/form&gt; 
  </code></pre>