Yet Another MySQL Problem

Victor Subervi victorsubervi at gmail.com
Thu May 27 08:34:48 EDT 2010


Hi;
I have this code:

    sql = "insert into %s (%s) values ('%%s');" % (personalDataTable,
string.join(cols[1:], ', '))
#    cursor.execute(sql, string.join(vals[1:], "', '"))
    cursor.execute('insert into %s (%s) values ("%s");' %
(personalDataTable, string.join(cols[1:], ', '), string.join(vals[1:], '",
"')))

Now, if I uncomment the 2nd line and comment the third, the command fails
because, apparently, that "');" at the tail end of sql (1st line) gets
chopped off. Why??
TIA,
beno

(Note to self: enterPeople3.py)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100527/f7b9ae6c/attachment.html>


More information about the Python-list mailing list