Code: Alles auswählen
...
with closing(mydb.cursor()) as cursor:
cursor.execute("SELECT * FROM Stand where Wand = %s", [SE])
result = cursor.fetchone()
if result is not None:
cursor.execute("SELECT * FROM Stand where Wand = %s", [SE])
result = cursor.fetchall()
for row in result:
if row[6] == "r":
print(row[6])
elif row[6] == "v"
cursor.execute("INSERT INTO Stand (Wand, Boden, Decke, Schrank, Stuhl) VALUES (%s, %s, %s, %s, %s)", [ xDu01, xDu02, xDu03, xDu04, xDu05 ])
mydb.commit()
else:
print("In DB ohne Zuordnung")
else:
cursor.execute("INSERT INTO Bude (Bu01, Bu02) VALUES (%s, %s)", [ xBu01, xBu02 ])
mydb.commit()
print("In DB Eingetragen")
...
Es lappt alles soweit bis auf nach dem letzen "else:", code wo darin noch steht wird auch ausgeführt, z.b. "print("In DB Eingetragen")"
nur der SQL Befehl nicht und ich weiß nicht warum und wieso nicht, habe auf abstände geachtet ( 4 leerstellen )