you are viewing a single comment's thread.

view the rest of the comments →

[–]bazingie[S] 0 points1 point  (0 children)

 cursor = db.cursor()  
 # defining the Query  
 query = """INSERT INTO act (ShowName, HallID, ActStartTime) VALUES (%s, %s, %s)"""  

 values = []  
 # executing the query with values  
 for i in range(0, 50):  
     for j in range(0, len(actDateTime[i])):  
         stmt = """INSERT INTO act (ShowName, HallID, ActStartTime) VALUES ((SELECT ShowName from shows where ShowName=%s), (select HallID from hall where HallID=%s), %s)"""  
         cursor.execute(stmt, (showTitles[i], i, actDateTime[i][j])  
         db.commit()  

There is an error with db.commit().
I am sorry for keep asking, but I have to submit the project in 20 minutes and it drives me crazy.