query($query_inv3);
$execu_inv3 = $consu_inv3->fetch_array(MYSQLI_BOTH);
$id=$execu_inv3['id'];
$costo=$_POST['costo'];
$um=$_POST['um'];
$fec=date("Y-m-d H:i:s");
$fec1=date("Y-m-d");
$query_modificar1 = "UPDATE inventario
SET id_tipo = '$tipo',
id_proveedor = '$proveedor',
dsc_producto = '$descripcion',
ancho = '$ancho',
alto = '$alto',
grosor = '$grosor',
id_um = '$um',
costo = '$costo',
fecha_alta = '$fec1',
precio='$precio',
id_categoria_ecomm = '$categoria_ecom',
activo_ecomm = '$activo_ecom'
WHERE codigo='$codigo'";
$consu_modificar1 = $conexion -> query ($query_modificar1);
if ($conexion->error) {
try {
throw new Exception("MySQL error $conexion->error
Query:
$query_modificar1", $conexion->errno);
} catch(Exception $e ) {
echo "Error No: ".$e->getCode(). " - ". $e->getMessage() . "
";
echo nl2br($e->getTraceAsString());
}
}
if($consu_modificar1){
if(basename($_FILES["fileToUpload"]["name"])!=''){
$target_dir = "img_art/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$target_file = $target_dir . 'art_'.$id.'.'.$imageFileType;
$target_file1 = 'art_'.$id.'.'.$imageFileType;
if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)){
$query_modificar = " UPDATE inventario
SET img = '$target_file1'
WHERE codigo='$codigo' ";
$consu_modificar = $conexion -> query ($query_modificar);
if (!$conexion->error) {
printf("Errormessage: %s\n", $conexion->error);
}
}
if($consu_modificar){
header("Location: index.php?menu=1&sub=1&cde=no");
} else{
header("Location: index.php?menu=1&sub=1&cde=1");
}
}
header("Location: index.php?menu=1&sub=1&cde=no");
}else{
header("Location: index.php?menu=1&sub=1&cde=1");
}
?>