cur.execute中的python / mysql编程错误

时间:2018-08-01 14:31:20

标签: mysql mysql-python mysql-error-1064

def get_data_from_pendingAttendance():

db = MySQLdb.connect(host="localhost",    # your host, usually localhost
                 user="root",         # your username
                 passwd=" ",  # your password
                 db="staticdb")        # name of the data base

    global curr_hour # time for the course to be queried
    global curr_date
cur = db.cursor()

cur.execute(""" UPDATE startsaver SET Stop= '1' WHERE CourseId = %s and TheDate = %s""", (course_id, curr_date))
cur.execute("""select StudentId,TheDate,CourseId from pendingattendance where CourseId = %s and TheDate = %s""", (course_id,curr_date))
    query_out = cur.fetchall()

    db.commit()

我收到以下错误:_mysql_exceptions.ProgrammingError:(1064,“您的SQL语法有错误;请查看与MySQL服务器版本相对应的手册,以在'附近使用正确的语法)和TheDate ='2018在第一行cur.execute()行的-05-03'')。

0 个答案:

没有答案