Menu

problem with c.insert_id()

Help
Who Ha
2001-12-13
2012-09-19
  • Who Ha

    Who Ha - 2001-12-13

    I'm kind of a newbie so sorry if this is an obvious question, but I could find a straight answer on the web.
    I'm trying to use an id I got from
    artid = c.insrt_id()
    in an insert statement
    c.execute("""INSERT into disc (title, artid, genre, year, created) VALUES (%s, %u, %s, %s, NOW())""",(id3info.album, artid, id3info.genre, id3info.year))

    When I try running it I get an error that point to the c.execute statement and says
    _mysql_exceptions.OperationalError: (1054, "Unknown column 'artid' in 'field list'")

    I know this probably has to do with the id being a long int.  Anyway I'm running python 2.1 and MySQL-python-0.9.1  According to the documentation python should handle the conversion automatically in 2.1.

     
    • Andy Dustman

      Andy Dustman - 2001-12-13

      Use %s for all parameter placeholders.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.