Beispiel #1
0
def del_lname():
    form = addForm()
    if request.method == 'POST':
        lname = request.form["lname"]

        sql = "DELETE FROM student_list WHERE lastname = %s"
        adr = (lname, )
        mycursor.execute(sql, adr)
        mydb.commit()
        flash('Operation Successfully Executed!')
        return redirect(url_for('view_user'))

    return render_template('del_lname.html', form=form)
Beispiel #2
0
def del_id():
  form = addForm()
  if request.method == 'POST':
    id = request.form["id"].upper()

    sql = "DELETE FROM student_list WHERE id = %s"
    adr = (id, )
    mycursor.execute(sql, adr)
    mydb.commit()

    flash('Operation Successfully Executed!')
    return redirect(url_for('view_user'))

  return render_template('del_id.html', form=form)
Beispiel #3
0
def add_student():
    form = addForm()
    if request.method == 'POST':
        id = request.form["id"]
        lname = request.form["lname"]
        fname = request.form["fname"]
        course = request.form["course"]
        year = request.form["year"]
        gender = request.form["gender"]

        sql = "INSERT INTO student_list (id, lastname, firstname, course, year , gender) VALUES (%s, %s, %s, %s, %s, %s)"
        val = (id, lname, fname, course, year, gender)
        mycursor.execute(sql, val)
        mydb.commit()

        flash('Operation Successfully Executed!')
        return redirect(url_for('view_user'))

    return render_template('add_student.html', form=form)