Professional Documents
Culture Documents
Advance Operation (Module 1)
Advance Operation (Module 1)
SESSION 9
ADVANCE OPERATION
TODAY’S QUOTES
IT IS NOT THAT
I AM SO SMART,
BUT I STAY
WITH THE QUESTIONS
MUCH LONGER
1
AAKKAM
STAFFSTUVIEW.HTML
<td><a href="{{url_for('upattendence',id=stu[0])}}">Attendence</a></td>
UPATTENDENCE.HTML
<form class="form-
<div class="col-sm-6">
<div class="form-group">
<input class="form-
control valid" name="name" value="{{stu[1]}}" type="text" placeholder="Enter
your student name">
</div>
</div>
<div class="col-sm-6">
2
AAKKAM
<div class="form-group">
<input class="form-
control valid" name="rollno" value="{{stu[2]}}" type="text" placeholder="Enter
your Rollno">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-
control valid" name="att" value="{{stu[10]}}" type="text" placeholder="Enter St
udent Attendence">
</div>
</div>
</div>
3
AAKKAM
APP.PY
@app.route("/upattendence",methods=['POST','GET'])
def upattendence():
conn=mysql.connect()
cur=conn.cursor()
stuid=request.args.get('id')
cur.execute("SELECT * FROM `student` WHERE `id`='"+stuid+"'")
student1=cur.fetchone()
if request.method=='POST':
att=request.form['att']
conn=mysql.connect()
cur=conn.cursor()
cur.execute("UPDATE `student` SET `att`='"+att+"'WHERE `id`='"+stuid+"'
")
conn.commit()
return redirect('staffviewstu')
else:
return render_template("upattendence.html",stu=student1)
4
AAKKAM
@app.route("/studentlogin",methods=['POST','GET'])
def studentlogin():
if request.method=='POST':
rollno=request.form['rollno']
conn=mysql.connect()
cur=conn.cursor()
cur.execute("SELECT * FROM `student` WHERE `rollno`='"+rollno+"'")
data=cur.fetchone()
if data[2]==rollno:
return redirect(url_for('studenthome',id=data[0]))
else:
error='invalid'
else:
return render_template("studentlogin.html")
@app.route("/studenthome")
def studenthome():
stuid=request.args.get('id')
return render_template("studenthome.html",student=stuid)
5
AAKKAM
@app.route("/studentprofile")
def studentprofile():
conn=mysql.connect()
cur=conn.cursor()
stuid=request.args.get('id')
cur.execute("SELECT * FROM `student` WHERE `id`='"+stuid+"'")
student=cur.fetchone()
return render_template("studentprofile.html",stu=student)
STUDENTHOME.HTML
{% endfor %}
6
AAKKAM
STUDENTPROFILE.HTML
<html>
<head>
<style>
.bg
{
background-color: azure;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
/* Control the left side */
.left
{
background-color: azure;
height: 100%;
width:50%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
7
AAKKAM
float: left;
}
.right
{
background-color:azure;
height: 100%;
width: 40%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
float: right;
body,html{
height: 100%;
margin: 0;
}
</style>
8
AAKKAM
</head>
<body>
<div class='bg'>'
<h1 style=" margin-left: 600px">View Profile</h1>
</div>
9
AAKKAM
</div>
</div>
</body>
</html>
10