Hi, I want to get dashboard data for editing, but it keeps occur an error and error log logs nothing regarding this page.
con = mysql.connect("hostaddress", "username", "pw", "database")
@app.route('/showSchoolPost/<int:School_Id>', methods=['GET'])
def showschoolpost(School_Id):
try:
if session.get('user'):
#con = mysql.connect()
cursor = con.cursor()
cursor.execute("select * from school where School_Id = %s",(School_Id))
schoolpost = cursor.fetchall()
return render_template('school_page_showpost.html', schoolpost=schoolpost)
else:
return redirect('/error')
except Exception as e:
return redirect('/error')
I checked it returns School_Id like /showSchoolPost/1, but it seems not to get as a parameter. I tried print(School_Id) and it printed nothing. This code worked in localhost. I can't find the error. Please help. Thanks.