diff --git a/brukerhistorieC.py b/brukerhistorieC.py
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..91e378b72cfe94566d1713a81ae82aa7916a7429 100644
--- a/brukerhistorieC.py
+++ b/brukerhistorieC.py
@@ -0,0 +1,80 @@
+import sqlite3
+
+con = sqlite3.connect("db1.db")
+cursor = con.cursor()
+
+def printStasjoner():
+    cursor.execute("SELECT StasjonsNavn FROM Jernbanestasjon")
+    stasjoner = cursor.fetchall()
+
+    print("STASJONER:")
+    for stasjon in stasjoner:
+        print(stasjon[0])
+
+def printRuter(brukerStasjon, brukerDag):
+    query = '''
+    SELECT T.Ankomsstid, T.Avgangsstid, T.Ukedag, T.Startstasjon, T.Sluttstasjon
+    FROM GaarInnom G, Togrute T
+    INNER JOIN Jernbanestasjon J ON G.Stasjonsnavn = J.Stasjonsnavn
+    WHERE J.Stasjonsnavn = ? AND T.TogruteID = G.TogruteID AND T.Ukedag = ?
+
+    UNION
+
+    SELECT T.Ankomsstid, T.Avgangsstid, T.Ukedag, T.Startstasjon, T.Sluttstasjon
+    FROM Togrute T
+    INNER JOIN Jernbanestasjon J ON T.Startstasjon = J.StasjonsNavn OR T.Sluttstasjon = J.StasjonsNavn
+    WHERE J.StasjonsNavn = ? AND T.Ukedag = ?
+    '''
+    cursor.execute(query, (brukerStasjon, brukerDag.capitalize(), brukerStasjon, brukerDag.capitalize()))
+    rows = cursor.fetchall()
+    return rows
+
+def checkStasjon(brukerStasjon):
+    query = "SELECT Stasjonsnavn FROM Jernbanestasjon WHERE Stasjonsnavn = ?"
+    cursor.execute(query, (brukerStasjon,))
+    stasjon = cursor.fetchall()
+    if (len(stasjon) != 0):
+        return True
+    else:
+        return False
+
+
+def checkRuter(brukerStasjon, brukerDag):
+    query = '''
+    SELECT G.TogruteID, T.Ukedag
+    FROM GaarInnom G, Togrute T
+    INNER JOIN Jernbanestasjon J ON G.Stasjonsnavn = J.Stasjonsnavn
+    WHERE J.Stasjonsnavn = ? AND T.TogruteID = G.TogruteID AND T.Ukedag = ?
+
+    UNION
+
+    SELECT T.TogruteID, T.Ukedag
+    FROM Togrute T
+    INNER JOIN Jernbanestasjon J ON T.Startstasjon = J.StasjonsNavn OR T.Sluttstasjon = J.StasjonsNavn
+    WHERE J.StasjonsNavn = ? AND T.Ukedag = ?
+    '''
+    cursor.execute(query, (brukerStasjon, brukerDag.capitalize(), brukerStasjon, brukerDag.capitalize()))
+    rows = cursor.fetchall()
+    return rows
+
+def run():
+    while True:
+        printStasjoner()
+        brukerStasjon = input("\nSKRIV INN NAVNET PÃ… EN STASJON: ")
+        if checkStasjon(brukerStasjon):
+            break
+        print("\n" + brukerStasjon.capitalize() +
+              " eksisterer ikke som stasjon.\n")
+    while True:
+        brukerDag = input("\nSKRIV INN EN UKEDAG: ")
+        if len(checkRuter(brukerStasjon, brukerDag)) == 0:
+            print("\n" + "Ingen togruter går innom " + brukerStasjon + " på en " + brukerDag + ".")
+        else:
+            print("\nDette er togrutene som går innom " + brukerStasjon + " på en " + brukerDag + ".")
+            for rute in printRuter(brukerStasjon, brukerDag):
+                print(rute)
+            break
+
+run()
+
+con.close()
diff --git a/db1.db b/db1.db
index 3fb4db475ae04f5d7ade03683014ee148570b59f..c93148d6872c41fe0b6fe01623f48a468a0009cd 100644
Binary files a/db1.db and b/db1.db differ
diff --git a/db2.py b/db2.py
index 7e79eaefc8f3004833d022518e6119fab637c849..2a4457618632856e5c6eacc2164050258f316a94 100644
--- a/db2.py
+++ b/db2.py
@@ -1,17 +1,21 @@
 import sqlite3
-con = sqlite3.connect("db2/db1.db")
+con = sqlite3.connect("db1.db")
 cursor = con.cursor()
 
+
 def createBanestrekning():
-    cursor.execute('''INSERT INTO Banestrekning VALUES (1, 'Nordlandsbanen', 'Diesel', 5)''')
+    cursor.execute(
+        '''INSERT INTO Banestrekning VALUES (1, 'Nordlandsbanen', 'Diesel', 5)''')
     con.commit()
 
+
 def getAllBanestrekning():
     cursor.execute("SELECT * FROM Banestrekning")
     rows = cursor.fetchall()
     print("Banestrekning:")
     print(rows)
 
+
 def createJernbanestasjon():
     cursor.execute('''INSERT INTO Jernbanestasjon VALUES ('Trondheim', 5.1)''')
     cursor.execute('''INSERT INTO Jernbanestasjon VALUES ('Steinkjer', 3.6)''')
@@ -21,75 +25,93 @@ def createJernbanestasjon():
     cursor.execute('''INSERT INTO Jernbanestasjon VALUES ('Bodø', 4.1)''')
     con.commit()
 
+
 def getAllJernbanestasjon():
     cursor.execute("SELECT * FROM Jernbanestasjon")
     rows = cursor.fetchall()
     print("Jernbanestasjon:")
     print(rows)
 
+
 def createDelstrekning():
-    cursor.execute('''INSERT INTO Delstrekning VALUES ('Trondheim', 'Steinkjer', 120, 'Dobbel')''')
-    cursor.execute('''INSERT INTO Delstrekning VALUES ('Steinkjer', 'Mosjøen', 280, 'Enkel')''')
-    cursor.execute('''INSERT INTO Delstrekning VALUES ('Mosjøen', 'Mo i Rana', 90, 'Enkel')''')
-    cursor.execute('''INSERT INTO Delstrekning VALUES ('Mo i Rana', 'Fauske', 170, 'Enkel')''')
-    cursor.execute('''INSERT INTO Delstrekning VALUES ('Fauske', 'Bodø', 60, 'Enkel')''')
+    cursor.execute(
+        '''INSERT INTO Delstrekning VALUES ('Trondheim', 'Steinkjer', 120, 'Dobbel')''')
+    cursor.execute(
+        '''INSERT INTO Delstrekning VALUES ('Steinkjer', 'Mosjøen', 280, 'Enkel')''')
+    cursor.execute(
+        '''INSERT INTO Delstrekning VALUES ('Mosjøen', 'Mo i Rana', 90, 'Enkel')''')
+    cursor.execute(
+        '''INSERT INTO Delstrekning VALUES ('Mo i Rana', 'Fauske', 170, 'Enkel')''')
+    cursor.execute(
+        '''INSERT INTO Delstrekning VALUES ('Fauske', 'Bodø', 60, 'Enkel')''')
     con.commit()
 
+
 def getAllDelstrekning():
     cursor.execute("SELECT * FROM Delstrekning")
     rows = cursor.fetchall()
     print("Delstrekning:")
     print(rows)
 
+
 def createSittevogn():
     cursor.execute('''INSERT INTO Sittevogn VALUES (1, 3)''')
     cursor.execute('''INSERT INTO Sittevogn VALUES (2, 3)''')
     con.commit()
 
+
 def getAllSittevogn():
     cursor.execute("SELECT * FROM Sittevogn")
     rows = cursor.fetchall()
     print("Sittevogn:")
     print(rows)
 
+
 def createSovevogn():
     cursor.execute('''INSERT INTO Sovevogn VALUES (1, 4)''')
     con.commit()
 
+
 def getAllSovevogn():
     cursor.execute("SELECT * FROM Sovevogn")
     rows = cursor.fetchall()
     print("Sovevogn:")
     print(rows)
 
+
 def createVogntype():
     cursor.execute('''INSERT INTO Vogntype VALUES (1, 'Sovevogn', null, 1)''')
     cursor.execute('''INSERT INTO Vogntype VALUES (2, 'Sittevogn', 1, null)''')
     cursor.execute('''INSERT INTO Vogntype VALUES (3, 'Sittevogn', 2, null)''')
     con.commit()
 
+
 def getAllVogntype():
     cursor.execute("SELECT * FROM Vogntype")
     rows = cursor.fetchall()
     print("Vogntype:")
     print(rows)
 
+
 def createOperator():
     cursor.execute('''INSERT INTO Operator VALUES (1, 'SJ', 1, 1)''')
     con.commit()
 
+
 def getAllOperator():
     cursor.execute("SELECT * FROM Operator")
     rows = cursor.fetchall()
     print("Operator:")
     print(rows)
 
+
 def createVognoppsett():
     cursor.execute('''INSERT INTO Vognoppsett VALUES (1, 2)''')
     cursor.execute('''INSERT INTO Vognoppsett VALUES (2, 2)''')
     cursor.execute('''INSERT INTO Vognoppsett VALUES (3, 1)''')
     con.commit()
 
+
 def getAllVognoppsett():
     cursor.execute("SELECT * FROM Vognoppsett")
     rows = cursor.fetchall()
@@ -97,12 +119,18 @@ def getAllVognoppsett():
     print(rows)
 
 # Må legge til for alle dager (ikke 3, kun alle hverdager), kun mandag som ligger inne nå. Må oppdatere GaarInnom også
+
+
 def createTogrute():
-    cursor.execute('''INSERT INTO Togrute VALUES (1, '09:05', '23:05', 'Mandag', 2, 1, 'Trondheim', 'Bodø', 'Hovedretning', 1)''')
-    cursor.execute('''INSERT INTO Togrute VALUES (2, '17:34', '07:49', 'Mandag', 1, 1, 'Trondheim', 'Bodø', 'Hovedretning', 1)''')
-    cursor.execute('''INSERT INTO Togrute VALUES (3, '14:13', '08:11', 'Mandag', 3, 1, 'Mo i Rana', 'Trondheim', 'Mot hovedretning', 1)''')
+    cursor.execute(
+        '''INSERT INTO Togrute VALUES (1, '09:05', '23:05', 'Mandag', 2, 1, 'Trondheim', 'Bodø', 'Hovedretning', 1)''')
+    cursor.execute(
+        '''INSERT INTO Togrute VALUES (2, '17:34', '07:49', 'Mandag', 1, 1, 'Trondheim', 'Bodø', 'Hovedretning', 1)''')
+    cursor.execute(
+        '''INSERT INTO Togrute VALUES (3, '14:13', '08:11', 'Mandag', 3, 1, 'Mo i Rana', 'Trondheim', 'Mot hovedretning', 1)''')
     con.commit()
 
+
 def getAllTogrute():
     cursor.execute("SELECT * FROM Togrute")
     rows = cursor.fetchall()
@@ -110,25 +138,39 @@ def getAllTogrute():
     print(rows)
 
 # Spørre om avgangstid og ankomsttid
+
+
 def createGaarInnom():
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Steinkjer', 1, '00:57', '00:55')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Mosjøen', 1, '04:41', '04:39')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Mo i Rana', 1, '05:55', '05:53')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Fauske', 1, '08:19', '08:17')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Steinkjer', 2, '09:51', '09:49')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Mosjøen', 2, '13:20', '13:18')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Mo i Rana', 2, '14:31', '14:39')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Fauske', 2, '16:49', '16:47')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Mosjøen', 3, '09:14', '09:12')''')
-    cursor.execute('''INSERT INTO GaarInnom VALUES ('Steinkjer', 3, '12:31', '12:29')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Steinkjer', 1, '00:57', '00:55')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Mosjøen', 1, '04:41', '04:39')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Mo i Rana', 1, '05:55', '05:53')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Fauske', 1, '08:19', '08:17')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Steinkjer', 2, '09:51', '09:49')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Mosjøen', 2, '13:20', '13:18')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Mo i Rana', 2, '14:31', '14:39')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Fauske', 2, '16:49', '16:47')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Mosjøen', 3, '09:14', '09:12')''')
+    cursor.execute(
+        '''INSERT INTO GaarInnom VALUES ('Steinkjer', 3, '12:31', '12:29')''')
     con.commit()
 
+
 def getAllGaarInnom():
     cursor.execute("SELECT * FROM GaarInnom")
     rows = cursor.fetchall()
     print("Mellomstasjoner:")
     print(rows)
 
+
 def createTilhorendeVognoppsett():
     cursor.execute('''INSERT INTO TilhorendeVognoppsett VALUES (1, 2, 1)''')
     cursor.execute('''INSERT INTO TilhorendeVognoppsett VALUES (1, 3, 2)''')
@@ -137,24 +179,28 @@ def createTilhorendeVognoppsett():
     cursor.execute('''INSERT INTO TilhorendeVognoppsett VALUES (3, 2, 1)''')
     con.commit()
 
+
 def getAllTilhorendeVognoppsett():
     cursor.execute("SELECT * FROM TilhorendeVognoppsett")
     rows = cursor.fetchall()
     print("Vognoppsett til vogntype:")
     print(rows)
 
+
 def createTilhorendeOperator():
     cursor.execute('''INSERT INTO TilhorendeOperator VALUES (1, 1)''')
     cursor.execute('''INSERT INTO TilhorendeOperator VALUES (1, 2)''')
     cursor.execute('''INSERT INTO TilhorendeOperator VALUES (1, 3)''')
     con.commit()
 
+
 def getAllTilhorendeOperator():
     cursor.execute("SELECT * FROM TilhorendeOperator")
     rows = cursor.fetchall()
     print("Vogntype til operatør:")
     print(rows)
 
+
 def createAll():
     createJernbanestasjon()
     createBanestrekning()
@@ -169,20 +215,28 @@ def createAll():
     createTilhorendeVognoppsett()
     createTilhorendeOperator()
 
-# Denne lager all data
-# createAll()
-
-getAllJernbanestasjon()
-getAllBanestrekning()
-getAllDelstrekning()
-getAllSittevogn()
-getAllSovevogn()
-getAllVogntype()
-getAllOperator()
-getAllVognoppsett()
-getAllTogrute()
-getAllGaarInnom()
-getAllTilhorendeVognoppsett()
-getAllTilhorendeOperator()
-
-con.close()
\ No newline at end of file
+
+def getAll():
+    getAllJernbanestasjon()
+    getAllBanestrekning()
+    getAllDelstrekning()
+    getAllSittevogn()
+    getAllSovevogn()
+    getAllVogntype()
+    getAllOperator()
+    getAllVognoppsett()
+    getAllTogrute()
+    getAllGaarInnom()
+    getAllTilhorendeVognoppsett()
+    getAllTilhorendeOperator()
+
+# Denne lager all data:
+# All data skal ligge inne fra før av, så skal ikke i utgangspunkte bruke denne med mindre man har slettet dataen
+## createAll()
+
+# Denne skriver ut all data:
+## getAll()
+
+
+
+con.close()