The problem is this: When the command runs, it does not replace the data in the database.
I looked at countless pages but found no solution to the problem.
But it doesn't give an error.
Script:
@app.route('/profil', methods=['GET', 'POST'])
def profil():
if 'loggedin' in session:
cursor = mysql.connection.cursor(MySQLdb.cursors.DictCursor)
cursor.execute('SELECT * FROM users WHERE id = %s', (session['id'],))
account = cursor.fetchone()
if request.method == 'POST':
file = request.files['file']
filename = secure_filename(file.filename)
path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
file.save(path)
cursor.execute('UPDATE users SET file_name = %s WHERE id = %s', (filename,account['id'],))
return filename
return render_template('profil.html', account=account)
return redirect(url_for('login'))```