I was working on this project using flask, and I am trying to create a route where you can see a post's info (every post's an ID insert in a table like a primary key)
I was trying to display the row values by the primary key (id) on an HTML file. I mean something like this:
primary key(id)-> title's value -> description's value
And display them all together by just having the id (that we got by the route variable) that is the primary key. However, I don't know if this is possible. Does someone have any idea?
@app.route("/post/<id>")
def post_list(id):
db = get_db()
post_id = db.execute("SELECT * FROM post WHERE id = ?", [id])
result_id = post_id.fetchone()
return "<h1>ID: {}</h1>".format(result_id["id"])