2017-02-04 108 views
-4

我有這樣的代碼SQLSTATE [HY093]無效的參數號,所有的參數相匹配

switch ($var1) { 
case 'corredor':{ 
    $query = ' UPDATE corredor 
       SET 
         cedula = :cedula, 
         nombres = :nombres, 
         apellidos = :apellidos, 
         fechanacimiento = :fechanacimiento, 
         telefono = :telefono, 
         correo = :correo, 
         direccion = :direccion, 
         fecharegistro = :fecharegistro, 
         estatus = :estatus, 
         aseguradora_rif =: aseguradora_rif 
       WHERE cedula = :cedula_old 
      '; 
    $query_params = array(
     ':cedula' => $_POST['cedula'], 
     ':nombres' => $_POST['nombres'], 
     ':apellidos' => $_POST['apellidos'], 
     ':fechanacimiento' => $_POST['fechanacimiento'], 
     ':telefono' => $_POST['telefono'], 
     ':correo' => $_POST['correo'], 
     ':direccion' => $_POST['direccion'], 
     ':fecharegistro' => $_POST['fecharegistro'], 
     ':estatus' => $_POST['estatus'], 
     ':aseguradora_rif' => $_POST['aseguradora_rif'] 
     ':cedula_old' => $var2 
     ); 
    try { 
     $stmt = $db->prepare($query); 

     $result = $stmt->execute($query_params); 
    } catch (PDOException $ex) { 
     $ex->getMessage(); 
    } 
    #header('Location: index.php?do=listacorredor'); 
    break; 
} //fin case 

我越來越

SQLSTATE [HY093]:無效的參數編號:綁定變量的數目不令牌

,我不知道爲什麼,我所有的參數都是符合的匹配號碼,我已經找了額外的,在查詢的末尾,而params所有的綁定匹配數據B因爲我在這裏輸了,其他的答案是失蹤的東西,或類似的東西,但真的不能在這裏看到問題。

+0

你有後多餘的逗號' ':cedula_old'=> $ VAR2,',沒有上面的線。 – Qirel

+0

哦是的,我正在測試,同時發佈這個,如果刪除,我仍然得到相同的錯誤。 –

+0

'aseguradora_rif =:aseguradora_rif'你在這裏有一個額外的空間 –

回答

相關問題