Пример #1
0
def rechange_reviews(message):
    try:
        cursor.execute("DELETE FROM reviews WHERE id = %s", message.text)
        connection.commit()
        bot.send_message(message.chat.id, '✅ Успешно.')
    except:
        logging.exception('-----------------------------------------------')
Пример #2
0
def change_inst(message):
    try:
        cursor.execute("UPDATE const_info SET data = %s WHERE id = 5", message.text)
        connection.commit()
        bot.send_message(message.chat.id, '✅ Успешно.')
    except:
        logging.exception('-----------------------------------------------')
Пример #3
0
def change_reviews(message):
    try:
        a = []
        cursor.execute('SELECT id from reviews')
        for i in cursor.fetchall():
            a.append(str(i).replace('(', '').replace(')', '').replace(',', ''))
        cursor.execute("INSERT INTO reviews VALUES(%s, %s)", (int(max(a)) + 1, message.text))
        connection.commit()
        bot.send_message(message.chat.id, '✅ Успешно.')
    except:
        logging.exception('-----------------------------------------------')
Пример #4
0
from imp import cursor, connection

#cursor.execute('create database telegram_bot')
#connection.commit()

cursor.execute(
    'CREATE TABLE const_info(id INT AUTO_INCREMENT PRIMARY KEY, data TEXT)')
connection.commit()

cursor.execute(
    'CREATE TABLE reviews(id INT AUTO_INCREMENT PRIMARY KEY, data TEXT)')
connection.commit()

cursor.execute("INSERT INTO const_info VALUES (%s, %s)",
               (1, 't.me/heree_name'))
connection.commit()

cursor.execute("INSERT INTO const_info VALUES (%s, %s)", (2, 'yandex.ru'))
connection.commit()

cursor.execute("INSERT INTO const_info VALUES (%s, %s)",
               (3, '*****@*****.**'))
connection.commit()

cursor.execute("INSERT INTO const_info VALUES (%s, %s)", (4, 'все'))
connection.commit()

cursor.execute("INSERT INTO const_info VALUES (%s, %s)", (5, 'fgdfgdfgdfg'))
connection.commit()

cursor.execute("INSERT INTO reviews VALUES (%s, %s)", (1, 'супер'))