B
B
Bug2019-12-09 21:45:37
Python
Bug, 2019-12-09 21:45:37

How to display variable values ​​from BD?

There is a database, it has a table "cmd" column "num_chat", how can I display the value from this column?
(in the table not only this variable)
my bad code is:

import sqlite3

conn = sqlite3.connect("DataBasa.db")
print('DataBasa подключена!')
c = conn.cursor()

a = 0
c.execute("SELECT * FROM cmd WHERE num_chat = %d" % (a))
b = c.fetchall()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2019-12-09
@thema__python3

Go and learn to find all the required information in the docks https://docs.python.org/3/library/sqlite3.html
Google is also worth learning

L
lightmanLP, 2019-12-10
@lightmanLP

You DB show us.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question