I am working with PDO in PHP I have a CRUD for the consultations, in the view I call the controller and in the controller I call the CRUD model to execute the sentence, I do not know why it is returning false, the code is the following :
$stmt = Conexion::conectar()->prepare("INSERT INTO $tabla(nombre,
paterno,
fechaReserva,
correo,
checkin,
noches,
personas,
comentarios,
huesped satisfecho,
habitacion) VALUES(:nombre,
:paterno,
:fechaReserva,
:correo,
:checkin,
:noches,
:personas,
:comentarios,
:satisfecho,
:habitacion)");
$stmt -> bindParam(":nombre", $datosModel["nombre"], PDO::PARAM_STR);
$stmt -> bindParam(":paterno", $datosModel["paterno"], PDO::PARAM_STR);
$stmt -> bindParam(":fechaReserva", $datosModel["fechaReserva"], PDO::PARAM_STR);
$stmt -> bindParam(":correo", $datosModel["email"], PDO::PARAM_STR);
$stmt -> bindParam(":checkin", $datosModel["checkin"], PDO::PARAM_STR);
$stmt -> bindParam(":noches", $datosModel["numeroNoches"], PDO::PARAM_STR);
$stmt -> bindParam(":personas", $datosModel["numeroPersonas"], PDO::PARAM_STR);
$stmt -> bindParam(":comentarios", $datosModel["comentarios"], PDO::PARAM_STR);
$stmt -> bindParam(":satisfecho", $datosModel["satisfecho"], PDO::PARAM_STR);
$stmt -> bindParam(":habitacion", $datosModel["habitacion"], PDO::PARAM_STR);
var_dump($datosModel);
var_dump($stmt -> execute());
It is worth mentioning that the $ dataModel array that receives the function as a parameter together with $ table brings the data that I send to the controller, it does not mark any error simply by executing false returns, the var_dump of the array has the following information:
array (size=16)
'nombre' => &string 'prueba' (length=6)
'paterno' => &string 'prueba' (length=6)
'fechaReserva' => &string 'prueba' (length=6)
'email' => &string 'prueba' (length=6)
'habitacion' => &string 'habitacion' (length=10)
'canalReservacion' => &string 'Selecciona' (length=10)
'descuento' => &string 'prueba' (length=6)
'costoTotal' => &string 'prueba' (length=6)
'presento' => &string 'si' (length=2)
'checkin' => &string 'prueba' (length=6)
'numeroNoches' => &string 'prueba' (length=6)
'numeroPersonas' => &string 'prueba' (length=6)
'tipoPago' => &string 'default' (length=7)
'comentarios' => &string 'prueba' (length=6)
'pagoObligatorio' => &string 'si' (length=2)
'satisfecho' => &string 'si' (length=2)