Soy nuevo en php, estoy tratando de agregar datos através de un formulario en Modal en php cuando le guardo me aparece este error
Google translate:
I am new to php, I am trying to add data through a form in Modal in php when I save it I get this error
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
Y me he puesto a ver y a investigar y no doy con la solución alguien me puede ayudar?, Este es mi código
Google translate:
And I have started to see and investigate and I can't find the solution, can someone help me? This is my code
What I have tried:
open();
try{
$s = $db->prepare($sql);
$stmt = $db->prepare("INSERT INTO empleados (idEmp, cedula, genero, Nombres, Apellidos, sitenac, edad, yearnac, municipio, estado, direccion, tvivienda, condicionv, tlfhab, tlfpersonal, email, habilidades, alergico, peso, estatura, camisa, pantalon, zapatos, lateridad, canaima, operativa, ccodigo, pprocedimiento, beca, designado, colegioproviene, hermano, hermanoname, hermanomencion, observaciones, representanteci, repgenero, repname, parentesco, reptlf, reptlfcasa, represitenac, repdirecion, repocupacion, reptlftrab, reptlffamily, reptlfvecino, repdirjob, repcta, repbco, repctatipo, repemail, repcardserial, repcardcode) VALUES (:idEmp, :cedula, :genero,:Nombres,:Apellidos, :sitenac, :edad, :yearnac, :municipio, :estado, :direccion, :tvivienda, :condicionv, :tlfhab, :tlfpersonal, :email, :habilidades, :alergico, :peso, :estatura, :camisa, :pantalon, :zapatos, :lateridad, :canaima, :operativa, :ccodigo, :pprocedimiento, :beca, :designado, :colegioproviene, :hermano, :hermanoname, :hermanomencion, :observaciones, :representanteci, :repgenero, :repname, :parentesco, :reptlf, :reptlfcasa, :represitenac, :repdirecion, :repocupacion, :reptlftrab, :reptlffamily, :reptlfvecino, :repdirjob, :repcta, :repbco, :repctatipo, :repemail, :repcardserial, :repcardcode)");
$_SESSION['message'] = ( $stmt->execute(array(':cedula' => $_POST['cedula'] , ':genero' => $_POST['genero'] , ':Nombres' => $_POST['Nombres'], ':Apellidos' => $_POST['Apellidos'], ':sitenac' => $_POST['sitenac'], ':edad' => $_POST['edad'] , ':yearnac' => $_POST['yearnac'] , ':municipio' => $_POST['municipio'], ':estado' => $_POST['estado'], ':direccion' => $_POST['direccion'], ':tvivienda' => $_POST['tvivienda'] , ':condicionv' => $_POST['condicionv'] , ':tlfhab' => $_POST['tlfhab'], ':tlfpersonal' => $_POST['tlfpersonal'], ':email' => $_POST['email'], ':habilidades' => $_POST['habilidades'] , ':alergico' => $_POST['alergico'] , ':peso' => $_POST['peso'], ':estatura' => $_POST['estatura'], ':camisa' => $_POST['camisa'],':pantalon' => $_POST['pantalon'] , ':zapatos' => $_POST['zapatos'] , ':lateridad' => $_POST['lateridad'], ':canaima' => $_POST['canaima'], ':operativa' => $_POST['operativa'] , ':pprocedimiento' => $_POST['pprocedimiento'] , ':beca' => $_POST['beca'], ':designado' => $_POST['designado'], ':colegioproviene' => $_POST['colegioproviene'],':hermano' => $_POST['hermano'] , ':hermanoname' => $_POST['hermanoname'] , ':hermanomencion' => $_POST['hermanomencion'],':observaciones' => $_POST['observaciones'] , ':representanteci' => $_POST['representanteci'] , ':repgenero' => $_POST['repgenero'],':repname' => $_POST['repname'] , ':parentesco' => $_POST['parentesco'],':reptlf' => $_POST['reptlf'] , ':reptlfcasa' => $_POST['reptlfcasa'] , ':represitenac' => $_POST['represitenac'], ':repdirecion' => $_POST['repdirecion'] , ':repocupacion' => $_POST['repocupacion'] , ':reptlftrab' => $_POST['reptlftrab'],':reptlffamily' => $_POST['reptlffamily'] , ':reptlfvecino' => $_POST['reptlfvecino'],':repdirjob' => $_POST['repdirjob'] , ':repcta' => $_POST['repcta'] , ':repbco' => $_POST['repbco'],':repctatipo' => $_POST['repctatipo'] , ':repemail' => $_POST['repemail'] , ':repcardserial' => $_POST['repcardserial'], ':repcardcode' => $_POST['repcardcode'])) ) ? 'Empleado guardado correctamente' : 'Algo salió mal. No se puede agregar miembro';
}
catch(PDOException $e){
$_SESSION['message'] = $e->getMessage();
}
$database->close();
}
else{
$_SESSION['message'] = 'Llene el formulario de inscripción';
}
header('location: index.php');
?>