O
O
ogo22021-01-16 21:30:37
Python
ogo2, 2021-01-16 21:30:37

How to check if such record exists in SQLite database?

def proverka():
    vid_foot = f'SELECT * FROM USERS WHERE ("vid") VALUES (?)', ("Печать на футболках", )
    connection = sqlite3.connect("basa35.db")
    cursor = connection.cursor()
    cursor.execute(vid_foot)
    result = cursor.fetchall()
    return result


@bot.message_handler(content_types=['text'])
def test2(message):
    true = proverka()
    if not true:
        bot.send_message(message.chat.id, 'не футболка')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fallenyasha, 2021-01-17
@Fallenyasha

Strange query syntax, probably it should be like this:

vid_foot = f"SELECT * FROM USERS WHERE vid = 'Печать на футболках'"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question