Jun-18-2020, 05:33 AM
(This post was last modified: Jun-18-2020, 05:33 AM by card51shor.)
Currently getting better results. I am now passing both variables through my template.
It's printing out more than I want though. I'm figuring that out now. Here is my current code:
HTML :
It's printing out more than I want though. I'm figuring that out now. Here is my current code:
HTML :
<ul id="results"> {% for i in search %} {% for j in link %} <a href="jack">{{j}}</a> <li>{{i}}</li> {% endfor %} {% endfor %} </ul>PYTHON:
@app.route("/search", methods=["GET", "POST"]) @app.route("/search/<isbnResult>") def search(): search = request.form.get("search") searchCombo = search + '%' isbnResult = db.execute("SELECT isbn FROM books WHERE author LIKE :search OR isbn LIKE :search OR title LIKE :search LIMIT 10", {'search': searchCombo}).fetchall() result = db.execute("SELECT * FROM books WHERE author LIKE :search OR isbn LIKE :search OR title LIKE :search LIMIT 10", {'search': searchCombo}).fetchall() print(result) return render_template("search.html", search=result, link=isbnResult)And here's the output I'm getting...obviously it's iterating over it too many times.