public static boolean updateItemInDatabase(Player p, ItemStack is,
			int qtyDelete) {
		if (is == null || p == null)
			throw new NullPointerException();
		WebInventoryMeta wim = new WebInventoryMeta(is);
		try {
			int dbQty = getItemCountDatabase(is);

			// Database vars
			Connection conn = MineAuction.db.getConnection();
			PreparedStatement ps = null;

			// Not enough items in database
			if (qtyDelete > dbQty) {
				return false;
			}

			// Delete row
			if (qtyDelete == dbQty) {
				ps = conn
						.prepareStatement("DELETE FROM ma_items WHERE itemID=? AND itemDamage=? AND enchantments = ?");
				ps.setInt(1, wim.getId());
				ps.setShort(2, wim.getDurability());
				ps.setString(3, wim.getItemEnchantments());

				ps.execute();

				// Return true if success
				return true;
			} else {
				// UPDATE ROW
				ps = conn
						.prepareStatement("UPDATE ma_items SET qty = qty - ? WHERE itemID=? AND itemDamage=? AND enchantments = ?");
				ps.setInt(1, qtyDelete);
				ps.setInt(2, wim.getId());
				ps.setShort(3, wim.getDurability());
				ps.setString(4, wim.getItemEnchantments());

				ps.execute();

				// Return true if success
				return true;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}