<div class="gmail_quote">On Sat, Dec 26, 2009 at 4:52 PM, Carsten Haese <span dir="ltr"><<a href="mailto:carsten.haese@gmail.com">carsten.haese@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Victor Subervi wrote:<br>
> Right. Thank you again. I'd forgotten to put in<br>
> enctype="multipart/form-data". Now I have the following snipped:<br>
><br>
> for pic in ourPics:<br>
> sql = 'update %s set pic%d=%s where ID="%s";' % (store, i,<br>
> (MySQLdb.Binary(pic),), id)<br>
> print sql<br>
> # cursor.execute(sql)<br>
<br>
</div>This binds the name <<sql>> to a string containing an "update" statement...<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> Which prints to screen the following:<br>
><br>
> insert into products (SKU, Category, Name, Title, Description, Price,<br>
> SortFactor, Availability, OutOfStock, ShipFlatFee, ShipPercentPrice,<br>
> ShipPercentWeight, Associations, TempPrice, LastDatePrice, Weight,<br>
> Metal, PercentMetal, pic0, pic1, sizes, colorsShadesNumbersShort)<br>
> values("prodSKU1", "prodCat1", "name1", "title1", "descr", "12.34",<br>
> "500", "1", "0", "10.00", "5", "2", "", "1", "2000-01-01", "2.5", "",<br>
> "20", "����� JFIF� �H�H����<br>
<br>
</div>...and that's an "insert" statement, so that's clearly not the output<br>
from the code you posted above.<br></blockquote><div><br>Oops. The update and insert are the same with regard to the problem at hand, but how were you to know? Sorry <:-} <br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
> and a bunch more binary data. This fails on insert. If I recall<br>
> correctly, I need to convert that binary data into something like (c,<br>
> array(... How do I do that? I'll include all code below in case it's<br>
> necessary.<br>
<br>
</div>You have been told many, many times before, by myself and others, not to<br>
embed values directly into the query string. Use parameter binding to<br>
transmit the values to the database. I'm sure you'll find an old post of<br>
mine somewhere in the archives of this list in which I showed you how to<br>
do that.<br></blockquote><div><br></div></div>Thank you. Now I remember. Thank you for your patience, Carsten. I don't know why I'm so dense! At least I can laugh at myself :/<br>beno<br>