(flask) python - mysql - using where clause in a select query with variable from URL
<pre><code>@app.route('/select/&lt;username&gt;')
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)
</code></pre>

<p>I want to edit the select query in this script in order to have </p>

<pre><code>SELECT * FROm p_shahr WHERE os = username
</code></pre>

<p>How should I edit the query to include the <em>where clause</em> above to set <code>os</code> to <code>username</code> that is coming from URL?</p>