-2
這裏是我的查詢..如何在燒瓶中顯示多行?
@app.route('/teacher/<username>/files')
def view_files(username):
name = username
sql = "SELECT fid from files WHERE f_username ='" + name+ "'"
cur=mysql.connection.cursor()
cur.execute(sql)
for ids in cur.fetchall():
sql1 = "select f_name from files where fid = %s"
cur.execute(sql1,ids)
vf=cur.fetchall()
return render_template('view_files.html',vf=vf)
return 'No files uploaded'
我能打印出結果查詢僅第一行。 for循環的用法是否正確?