0

Я пишу на aiogram.введите сюда описание изображения Мне нужно чтобы пользователь вводил название архива и ему выводилось zip_pay и pass_pay

@dp.message_handler(state = FSMForms.history)
async def process_call(message: types.Message, state: FSMContext):
    async with state.proxy() as data:
        data['history'] = str(message.text)
        await bot.send_message(message.from_user.id, md.text(md.text('Вы ввели:', (data['history'])))),
        await db.user_hist(state)
    await state.finish()

И пытаюсь передать это сюда

async def user_hist(self, state):
        with self.connection:
            async with state.proxy() as data:
                for i in self.cursor.execute("SELECT `zip_pay`, `pass_pay` FROM `product` WHERE `zip_file` = ?", tuple(data.values)):
                    print(i)

но ничего не происходит

2
  • а если убрать кавычки внутри запроса? вот так: "SELECT zip_pay, pass_pay ... = ?" 1 фев 2022 в 17:02
  • я уже все решил
    – Slim Thugs
    1 фев 2022 в 17:04

1 ответ 1

0
def user_hist_zip(self, zip_file):
        result_zip = ""
        with self.connection:
            for i in self.cursor.execute("SELECT `zip_pay`, `pass_pay` FROM `product` WHERE `zip_file` = ?", (zip_file,)):
                result_zip += f"{i[0]}"
            return result_zip

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.