@app.route('/select/<username>')
def select(username):
db = MySQLdb.connect("localhost","myusername","mypassword","mydbname" )
cursor = db.cursor()
cursor.execute("SELECT * FROM p_shahr")
data = cursor.fetchall()
db.close()
return render_template('select.html', data=data)
I want to edit the select query in this script in order to have
SELECT * FROm p_shahr WHERE os = username
How should I edit the query to include the where clause above to set os
to username
that is coming from URL?