On Sep 17, 2005, at 3:04 PM, Ed Hotchkiss wrote:

> There is no oreilly in the code ... I still get an error, any other  
> ideas? sorry ...

     Strange; can you explain where the text quoted (reilly, Python,  
Archive, http://
python.oreilly.com/archive.html) came from, then?

     Also I noticed in another message on the list (this one drifted  
off-list, due to the poor choice of Reply-To: setting by the list  
admins; I'm moving it back) that you had another error:

     cursor.execute ("""
  INSERT INTO links (Name, URL, category)
      VALUES (%s, %s, %s) % tuple(links[0:3])
         """)

     This should be:

     cursor.execute ("""
  INSERT INTO links (Name, URL, category)
      VALUES (%s, %s, %s)""", links[0:3]
       )

You don't even need to cast the args into a tuple when you use  
MySQLdb's parameter handling. It will automatically add quotes to any  
string values, and will automatically escape any problematic  
characters, such as single quotes, semi-colons, etc.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to