Skip to content

Commit

Permalink
Update Teacher.py
Browse files Browse the repository at this point in the history
  • Loading branch information
alhusseain authored Jan 11, 2024
1 parent 62f0d87 commit 6e3fa88
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions classes/Teacher.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
from users import users
import pyodbc
connection=pyodbc.connect('Driver={SQL Server};SERVER=KAREEM;DATABASE=Coursiz;Trusted_Connection=yes')
query = connection.cursor()
from databaseConnection import db
db=db()
class teacher(users):

def __init__(self, teacher_id):
self.id = teacher_id
def sign_up(self):
query.execute('INSERT INTO Teachers (teacher_id, course_code) VALUES (?, ?)', ( self.teacher_id, self.course_code))
connection.commit()
db.cursor.execute('INSERT INTO Teachers (teacher_id, course_code) VALUES (?, ?)', ( self.teacher_id, self.course_code))
db.connection.commit()

def get_courses(self):
query.execute("select Course_Code from Courses where TeacherID = ?", (self.id))
db.cursor.execute("select Course_Code from Courses where TeacherID = ?", (self.id))
fetched=[]
for i in query.fetchall():
for i in db.cursor.fetchall():
i=i[0]
fetched.append(i)
return fetched
Expand All @@ -27,4 +26,4 @@ def get_courses(self):
# elif choice == "Sign up":
# self.sign_up(username, email, password)



0 comments on commit 6e3fa88

Please sign in to comment.