in python my code to fetch data from the table is as follows:
posts = get_db().execute(
'SELECT * FROM post WHERE (? = ?) ORDER BY created DESC', (name, value)
).fetchall()
name and value are variables depending on what the user clicks on the page.
The code won't work... how should it be written???
Addon:
Searching for a solution I bumped into the following:
def get_posts(name, tag):
posts = get_db().execute(
"""SELECT * FROM post WHERE ({} = ?)""".format(name), (tag,)
).fetchall()
But didn't work for me too...