S
S
Sergey Bondarenko2019-07-09 20:13:16
MySQL
Sergey Bondarenko, 2019-07-09 20:13:16

Fetch data from database using flask-mysql?

Good afternoon, I need to get the value from the column nameand save it to a variable, it seems that I was on the right path, but then something went wrong, the
code:

conn = db.connect()
cur = conn.cursor()
status = ''
cur.execute('''SELECT id FROM user WHERE name=%s''', (str(status)))
return render_template('pages/admin.html', title = 'Admin Panel', status=status)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-07-09
@lietryit

Firstly, you missed the comma - (str(status),)Secondly, you do not use the result of the selection in any way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question