'How to update database table with inline keyboard in telegram bot?

Trying to update database table with inline command but when I press inline button nothing happen. No errors, no crash. Just nothing and table doesn't update.

conn = sqlite3.connect('db/test.db', check_same_thread=False)
cursor = conn.cursor()

def button(message):
    button = types.InlineKeyboardMarkup(row_width=1)
    b1 = types.InlineKeyboardButton(text='Text', callback_data='example')
    button.add(b1)
    bot.send_message(message.chat.id, 'Some text', reply_markup=button)

@bot.callback_query_handler(func=lambda c: True)
def inline(c):
    if c.data == 'example':
        uid = c.message.from_user.id
        cursor.execute('UPDATE table SET column1 = ? WHERE user_id = ?', ('text', uid))
        conn.commit()

But if I do the same with another handler, that works perfectly:

@bot.message_handler(content_types=['text'])
def update(message):
    if message.text == 'Update':
        uid = message.from_user.id
        cursor.execute('UPDATE table SET column1 = ? WHERE user_id = ?', ('text', uid))
        conn.commit()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source