I have this statement ready to insert data, although it receives and leaves it inserted, it does not insert anything in the database:
Echo of the variables:
echo "<br>".$unidad;
echo "<br>".$cedula1;
echo "<br>".$cedula2;
echo "<br>".$cedula3
echo "<br>".$articulo_falta;
echo "<br>".$aparte_falta;
echo "<br>".$documentos_implode;
echo "<br>".$fecha_inicio;
echo "<br>".$fecha_termino;
echo "<br>".$dias;
echo "<br>".$aclaratoria;
echo "<br>".$estado_sancion_id;
echo "<br>".$tipo_medida;
echo "<br>".$tipo_circunstancia;
echo "<br>".$atenuantes_implode;
echo "<br>".$agravantes_implode;
echo "<br>".$total_demerito;
echo "<br>".$lugar;
Data of the Echo
033100000000
17739707
8644097
8644097
35
1
2-1
2017-03-23
2017-03-24
1
qwrqwrwq
1
2
40
3-4
0
6.55
2
Sentence
$stmt = $conexion->prepare("INSERT INTO sanciones (
unidad,
cedula_sancionado,
cedula_sancionador,
cedula_superior,
articulo_falta,
aparte_falta,
documento_seleccion,
fecha_inicio,
fecha_termino,
dias_sancion,
aclaratoria_sancion,
estado_sancion_id,
medida_id,
articulo_circunstancias,
agravante_seleccion,
atenuante_seleccion,
total_demerito,
estado_lugar_id)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
var_dump($stmt);
$stmt->bind_param("siiiiisssisiiissdi"
,$unidad
,$cedula1
,$cedula2
,$cedula3
,$articulo_falta
,$aparte_falta
,$documentos_implode
,$fecha_inicio
,$fecha_termino
,$dias
,$aclaratoria
,$estado_sancion
,$tipo_medida
,$tipo_circunstancia
,$agravantes_implode
,$atenuantes_implode
,$total_demerito
,$lugar);
$stmt->execute();
var_dump($stmt);
if ($stmt){
echo ('<script>alert("OMD generada satisfactoriamente!");</script>');
/*echo ("<script>window.location = 'menu_unidades.php';</script>");*/
$stmt->close();
}else{
echo ('<script>alert("No se pudo generar la OMD");</script>');
echo ("<script>window.location = 'menu_generar_omd_unidades.php';</script>");
}
"OMD generated successfully" exits but does not insert into the database
It started to fail when you add $ unit to the insert. the table has 19 fields (one is the auto-incremental ID)
The problem was that when the person entered some data this was disabled, to avoid that I decided to clone the text fields and when a field was filled it got its value, it turns out that several INT values were converted to STRING, multiplied by 1 the variables
Now the bind_param fails me