I have made a small flask app that pulls data from a MySQL source and places it into a table, however, the MySQL data is not correctly populating the table. (edit - by this i mean it is not populating at all, my bad)
mydb = mysql.connector.connect(
host=x,
user=x,
passwd=x,
database=x
)
def browserSettings_mysql():
curs = mydb.cursor()
curs.execute("SELECT DATE_FORMAT(dtime, '%Y-%m-%d %T') as timest, moisture, temp FROM moisture")
return curs.fetchall()
@app.route('/')
def index():
return render_template("index.html", rows = moistureControl.browserSettings_mysql())
<table>
<tr>
<th>Time</th>
<th>Temp</th>
<th>Moisture</th>
</tr>
{% for row in rows %}
<tr>
<td>{{row.timest}}</td>
<td>{{row.temp}}</td>
<td>{{row.moisture}}</td>
</tr>
{% endfor %}
</table>
How can I solve this?