Re: Another MySQL Images Question

2008-04-20 Thread Steve Holden
Dennis Lee Bieber wrote: > On Sat, 19 Apr 2008 03:46:54 +0200, Karl-Heinz Ruskowski > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Hi, >> >>> cursor.execute('update products set pic1="%s" where id="%s", ;', >>> (pic1, id)) >> Shouldn't it be something like >> curso

Re: Another MySQL Images Question

2008-04-18 Thread Karl-Heinz Ruskowski
Hi, > cursor.execute('update products set pic1="%s" where id="%s", ;', > (pic1, id)) Shouldn't it be something like cursor.execute('update products set pic1="%s" where id="%s", ;' % (pic1, id)) -- GPG key: 0x04B3BB96 pgpiL4LACYHv7.pgp Description: PGP signature -- http://mail.python.

Re: Another MySQL Images Question

2008-04-18 Thread Victor Subervi
Thank you. That worked. Victor On Fri, Apr 18, 2008 at 10:48 AM, J. Cliff Dyer <[EMAIL PROTECTED]> wrote: > There are several problems with your SQL, but not all of them would be > caught by the computer. Your SELECT statement is not parameterized. > This is a security problem. *Always* paramet

Re: Another MySQL Images Question

2008-04-18 Thread J. Cliff Dyer
There are several problems with your SQL, but not all of them would be caught by the computer. Your SELECT statement is not parameterized. This is a security problem. *Always* parameterize your variables. Your UPDATE statement has an extraneous comma at the end, and it also has quotes around the

Another MySQL Images Question

2008-04-18 Thread Victor Subervi
Hi; If I grab an image in the database thus: sql = "select pic1 from products where id='" + str(id) + "';" cursor.execute(sql) pic1 = cursor.fetchall()[0][0].tostring() # pic1 = cursor.fetchall()[0][0] // either this or the above line and try and re-insert it thus: c