Does this work? and stored it in a database, now I want to display the same data on my own website, but it doesn't work. Help please!
@auth.route('/')
def home():
def GetBookLink():
mydb = mysql.connector.connect(
host='localhost',
user = 'Salahudheen',
passwd = 'Salahudheen1!',
database = 'testdatabase'
)
mycursor = mydb.mycursor()
mycursor.execute("SELECT * FROM ScrapedBooks")
DBData = mycursor.fetchall()
mycursor.close()
return render_template("home.html", ScrapedBookData = DBData)
HTML :
{% extends "base.html"%} {% block title %}Home{% endblock %}{% block content %}
<h1>{{ScrapedBookData}}</h1>
{% endblock %}
Of course this isn't the format I'm going to display it in, but I just want to learn how to display it first