A
A
ARKRAFTER2021-02-21 15:28:04
SQLite
ARKRAFTER, 2021-02-21 15:28:04

Why doesn't it add sqlite3 to the table?

Why didn't you add it?

sql.execute(f"INSERT INTO properties VALUES (?,?,?,?)", ( serverid , '9999999999999999',False,False)) 

DB setup:
db = sqlite3.connect('Core.db')
sql = db.cursor()

sql.execute("""CREATE TABLE IF NOT EXISTS properties (
       serverid INT,
       MUsers BIGINT,
       TERMS boolean,
       Blocked boolean
  )""")
  
db.commit()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2021-02-21
@ARKRAFTER

You didn't provide all the code, so there is no exact answer!
This is how it works (and sql is usually called a query string, not a cursor):

import sqlite3

conn = sqlite3.connect('Core.db')
cursor = conn.cursor()

cursor.execute("""CREATE TABLE IF NOT EXISTS properties (
  serverid INT,
  MUsers BIGINT,
  TERMS boolean,
  Blocked boolean
  )""")

serverid = 1

cursor.execute(f"INSERT INTO properties VALUES (?,?,?,?)", ( serverid , '9999999999999999',False,False))

conn.commit()
conn.close()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question