I have this function to insert in myqli
function Insertar_Datos() { global $Conectar;
$Parametros = func_get_args();
$InDatos = "INSERT INTO '".$Parametros[0]."' (".$Parametros[1].") VALUES (".$Parametros[2].");";
$RDatos = mysqli_query($Conectar, $InDatos);
if (!$RDatos) { http_response_code(500); print(mysqli_error($Conectar)); } else { http_response_code(200); echo "ok"; }
return $RDatos;
}
how to use the function I am using this:
$InuevoArticulo = Insertar_Datos("Tabla" , "'id','nombre'" , "'".mysqli_real_escape_string($Conectar, $_POST['id'])."','".mysqli_real_escape_string($Conectar, $_POST['nombre'])."'");
As you see so far in parameters [2] I put all the code with the real scape bla bla bla ... Would there be any way that in parameters [2] just put $ _POST ['what_is_say'] and write in the insert all the code of mysqli_real_escape_string ($ Connect, ... automatically?
A thousand thanks for your help:)