I am trying to write code so that on the first page, you select a "project" and then it takes you to a page showing that project's name, description and deadline. All of the information is coming from a database.
When I test this part of the site, I get an internal server error and this feedback:
RuntimeError: unsupported value: {'project_id': 4}
I tried running my SQL queries separately from PHPMyAdmin, and it worked absolutely fine. I've tried everything I can think of, but this error keeps popping up and the information is not displaying on the second page.
Please tell me how to fix this or if I'm missing something incredibly obvious here.
Here is my code for this part of the website:
@app.route("/edit", methods=["GET", "POST"])
@login_required
def edit():
if request.method == "POST":
id = session['user_id']
project = request.form.get("proj")
proj_id = db.execute("SELECT project_id FROM project WHERE project = :project AND user_id = :id;", project=project, id=id)
description = db.execute("SELECT description FROM project WHERE project_id = :proj_id;", proj_id=proj_id)
deadline = db.execute("SELECT deadline FROM project WHERE project_id = :proj_id;", proj_id=proj_id)
return render_template("edits.html", project=project, description=description, deadline=deadline)
else:
id = session['user_id']
info = db.execute("SELECT project FROM project WHERE user_id = :id;", id=id)
projects = []
for row in info:
project = row["project"]
projects.append(row)
return render_template("edit.html",projects=projects)
Aucun commentaire:
Enregistrer un commentaire