![]() |
how to use variables when open a sqlite database? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: how to use variables when open a sqlite database? (/thread-36873.html) |
how to use variables when open a sqlite database? - 53535 - Apr-07-2022 this is my code import sqlite3 conn = sqlite3.connect("KJV+.SQLite3") c = conn.cursor() while True: b_id = input('Enter the book id: ') c = input('Enter the chapter: ') p = input('Enter the position: ') c.execute("select * from verses where book_number = [b_id] and chapter = [c] and verse = [p]") text = c.fetchmany(1) print(text) break RE: how to use variables when open a sqlite database? - ndc85430 - Apr-07-2022 Have you looked at the documentation? It does tell you how to parameterise a query. |