500000) {
echo "Please enter a file size between 5mb";
$upload_ok = 0;
} else { //
//Allow certain file formats
if($img_file_type != "jpg" && $img_file_type != "png" && $img_file_type != "jpeg" && $img_file_type != "gif") {
//echo "JPG, PNG, JPEG and GIF files are allowed";
$upload_ok = 0;
} else {
//Check if $upload_ok is set to 0 by an error
if($upload_ok === 0) {
echo "File has not been uploaded";
} else {
if(move_uploaded_file($temp_file_name, $target_file)){
$db_query = "UPDATE equipment set category = '$category', equipment_id = '$equipment_id', equipment_name = '$equipment_name', brand = '$brand', spec = '$spec', count_type = '$count_type',inventory = '$inventory',list_price = '$list_price',discount = '$discount',final_price = '$final_price',picture = '$target_file',create_at = '$create_at' WHERE id='$id'";
mysqli_query($link, $db_query);
header("location: equipment-index.php");
}
}
}
}
}
$affected = mysqli_affected_rows($link);
mysqli_close($link);
if ($affected > 0) {
echo "";
} elseif ($affected == 0) {
echo "";
} else {
echo "{$db_query} 語法執行失敗,錯誤訊息SSS: " . mysqli_error($link);
}
}
?>