I am migrating to use functions, insert the image but it does not recover it, in the previous normal code it inserts and recovers, it can be said that the image was collected like this:
$foto1 = $mysqli->real_escape_string(base64_decode($_REQUEST['foto1']));
Code with function:
<?php
function registrarDocente($nombre1,$apellidop1,$apellidom1,$correo1,$sexo1,$foto1, $codigo1,$password,$doc,$telefono1,$fecha1,$tdocumento1,$documento1){
global $mysqli;
$stmt = $mysqli->prepare("INSERT INTO usuarios nombres,apellidop,apellidom,foto,correo,tdoc,ndoc,user,password,tipo,genero,ntelefono,fnacimiento) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)");
$stmt-> bind_param('sssssiiisiiis',$nombre1,$apellidop1,$apellidom1,$foto1,$correo1,$tdocumento1,$documento1,$codigo1,$password,$doc,$sexo1,$telefono1,$fecha1);
if($stmt->execute()){
$data[]=array('mensaje'=> 'Docente registrado con exito');
echo json_encode($data);
}
}
?>
Previous code:
if ($verificacion1=='1D') {
//Sentencia, insertar registro.
if (mysqli_query($con,"INSERT INTO usuarios (nombres,apellidop,apellidom,foto,correo,tdoc,ndoc,user,password,tipo,genero,ntelefono,fnacimiento)
VALUES ('".$nombre1."','".$apellidop1."','".$apellidom1."','".$foto1."','".$correo1."','".$tdocumento1."','".$documento1."','".$codigo1."','".$password."',
'".$doc."','".$sexo1."','".$telefono1."','".$fecha1."')")){
$data[]=array('mensaje'=> 'Docente registrado con exito');
echo json_encode($data);
}else{
$data[]=array('mensaje'=> 'Docente no registrado');
echo json_encode($data);
}