Well, I've spent the last 2 days chasing my tail just to discover that there
was some screwy python deal going on. The following code works:

      sql = "update productsX set Name='%s', Title='%s', Description='%s',
Price='%s', Bedrooms='%s', Bathrooms='%s', Conditions='%s', Acreage='%s',
Construction='%s', Location='%s', Estate='%s', Address='%s', Furnished='%s'
where ID=%s;" % (name, title, description, price, bedrooms, bathrooms,
conditions, acreage, construction, location, estate, address, furnished, id)
      cursor.execute(sql)
      cursor.execute('update productsX set pic1=%s, pic2=%s, pic3=%s,
pic4=%s, pic5=%s, pic6=%s where ID=%s;', (pic1, pic2, pic3, pic4, pic5,
pic6, id))
Notice I have to use two separate sql calls and the only differences between
them are that the first have the strings in quotes AND there is a % sign
between the string widgets and the variables that replace them. That's it!
Wonder what the *#&^%( difference that makes.
V


On Thu, Oct 15, 2009 at 3:20 PM, Bram Mertens <mertensb.ma...@gmail.com>wrote:

>  On Thu, Oct 15, 2009 at 5:20 PM, Victor Subervi <victorsube...@gmail.com>
> wrote:
> > Hi;
> > My code was working fine then I must have inadvertently screwed something
> > up. The result is a mysql insert/update statement that looks something
> like
> > the following:
> >
> > update productsX set Name=%s, Title=%s, Description=%s, Price=%s,
> > Bedrooms=%s, Bathrooms=%s, Conditions=%s, Acreage=%s, Construction=%s,
> > Location=%s, Estate=%s, Address=%s, Furnished=%s, pic1=%s, pic2=%s,
> pic3=%s,
> > pic4=%s, pic5=%s, pic6=%s where ID=%s;', ('name1', 'title1', 'descr1',
> > '1.1', '2', '1', 'New', '1.5', 'New', 'arbor', 'abor', 'abor',
> 'Furnished',
> > 'ÿØÿà JFIF ÿÛC "" $(4,$&1' -=-157:::#+?D?8C49:7ÿÛC 7%
> > %77777777777777777777777777777777777777777777777777ÿÀ y| " ÿÄ ÿÄM !1A Qa
> "qs
> > ³ 27Bbc‚ #46Rrt‘¡±² $'3C’%5DTUƒ“¢£ÑñÿÄ ÿÄ ÿÚ ?œ*‹RP’¥¨% d’pªÔcµkä«”øZ Âá
> îj
> > Xêxö, `...@$ý ô¨2mÒžÚ ¦ ÚRÑ¥¬ò guD|!%bO :ðç’ Z…æµËÚvsM¡·¢&T ‘œ¬ ºâ “ñ
> > â1Ò¶¶KT[%¦-² {‘£6 Ô÷“âNI=äÒfÓ ø/RhËîR”³q1 QüÇ“ƒŸ ƒE Š Š( (¢Š Š( (¢Š Š( ×ê
> ´{
> > –mÒYü VTâ†pUŽI $à Qvà ɼÜ/ZÒì{IrÝ,´£È x ß #¸$Š·÷F_Ë ë}……áRTdH ó
> > Á#ÐU“ö*DÙõ¨Yt]ž îêÑ +p}5ùêÿ¹F † vã Êöy5Ô‚\ˆëO Žc 'ö(Óõku-´^4õÊÚ Ú£8Ðð%$
> ì84
> > Ú*ø G¥­·T Vû#µc æ ·uÏ; Ö"ÓusN\\Ü‹5{ÑʸvoòÝû@ é ¼×CP U
> > ¤¡%KPJR2I8T+´½¨®{ß{:)kzD‡; &2~1' ¤“ ïÙßA¶Õº®íª5 Ñú AiMçá ’O ’8 •tÆpHâNÇ
> > Uºl¤Ûmë¸é«ÝÙ øéí û’7�...@guc q Ó ŠhÙ¶ cFØ Í\çðäLJÎ^8$} ä í=i² Aj ©ôœ «‰J_u
> > /¥<ƒ‰%*áÓˆÎ;ˆ¦ TÐö©6)WûjØZ`ü dÂsæ–ÝHQB E@ m5Ð QE EbÜî
> > íP]›q’Üx̧yn8pÿ߇3IP5–¨¿´©úgL2å©K)aéÒû ¼ 5 ã‚s 8žT æÕæ*ýµ)Q’­ä4óp› ¦0
> ?ÌU]B
> > r + ç\»]_"éŸ pTŒŸXU] Èò ­ “¬gK ®tTxò^i‰ É 4‡ Rè ¤ à8 Y«›` üM ]ߊ󌼀ÑK
> > ,¥Iü29 ƃž6™iU‡]Ý£ È/²G 5~xÇ£8öT۱͡§SÀ ›«¿éˆÈॠÆ[ ;ô‡Qן~4»vÒOܬðu ”ëÐÙ
> Ë
> > %®a d“Ÿ g ¨Ãe1. õõœÛ æû2 ëËG$4>9' )$xç h3ö‰´Ë®­ ôHî.%œ,†ã ຠx S× ‡Ž3Nû
> > ÐËAûêº5Œ‚ˆ ¨qÁৠˆ ÓÜh±ìËOÏÚV¢‰ >`ÛTíÅß «.¤¨¥Gžè<€ãŽg½ãP<ìM£h¸1 [
> ÌÄ®;J)mA-
> > ÐR8 :g• ãXjû> ‚™W‡Ô „†Xho8é ÷G‡yÀâ8ñ ‡¤õ5ëQ¥‰Ÿ{žCjxo7"LÑÚ­ à ØG#Ú‡ ‘ž¨ t
> > –›-LjFžhÈÂXy¥(… \8) ŽJð} -ÜKp¬’ T–PÔu œî €“Œ ” ôTc¢ö…§íZ Ò«õùµMì
> h‚µ<öwŽ7€É
> > 1Î’šÛ2­7 ó ";= & b*Sê e Æ7xž|p è:@Ö[YÓÚq.1 Ñs¸'€b2 BOÓ_!è > ¡
> > ¦²Özòbm©}÷ƒêÂ`ÂFâ ¤ $ õ Š•vq±è–bÍÏR†æ\ ˆÃÎiƒãùê °tÏ A‡§4Þ Ú<ÆoÚíkfÐ… õ¤
> > %ÁÑE<Â|Oœ¯ ŒÌM4Û-!¦ ”6€ ”$`$ @ ‚½t¢ƒˆ_Bš}Æ× ä(¥Yç k®vqyM÷DÚf…ï9äéiîþÑ
> > j³é#>‚+™ö‘lU§]^¢) 'Ê”êüÅùéýÊ ñ÷?jÔÛ®¯iÙ®nÇœ­øÅG‚^ ˆû@ j...@ëa#럔 ú̯všÈÛGÉ
> > ë†|Ö½ò*θÇßö„â3å2º}ZjþÙ¾M/_ ß½E t_Ä™õiþ °ÖZogV÷ m qŽ¾´¤
> ¼:°2zð律¿‰³êÓü)/bC
> > 7¶ Ë´ ß.€Ò ÿJ:ÛÕÀ÷J«ZÍá i:9ò•(5 ಔŽ' ƒŠ½¥‡ö¡­x ‡ Ž>©UMT3µ- ×ðSýÐ 5†Ñ5
> > «.³6Yf Õ‘ ºØ‚ ê¬ ½Ô±"T‰Kß’û¯+½Å• ßSVÕö[c´Yn ŠÔãñ”…¡F Âšó–” Þ© vq“ÝÀVÝ
> > Óp!?"D«„· aj kJ ¼ xà óñ çÆ vC¨e†Öë‹8J ’¢£à :~Ùö˦ê‰Ó ¹H6æ 8–ä6¤ öñ Ýð
> :ž]ƦM
> > Zíñ´%®lxqÛ”ûJ/>†ÀZüõsW3Ê«³ÒF©Öé<…Ñ'ö¢ ƒKi[6•…äÖhik{ £ªóœt÷©\Ï£ è
> > nv´¡%...@ÉrŽ«sfg Ùs^C1ÙI[Ž,à$ ¦¢ØÓåm_Pöl¡Ö4m¹à§w I¸:8„Ÿ£Èîô ø‘º Í t¢‚
> > û¢t–˜š–*2 ix †r… i)ÏèÔ Ë®0ò ejmÆÔ …¤à¤Ž ƒß]«r ë E¾sIz4†Ën¶z¤ÿ Mr¶Ñt ý
> > r)XSö×T|šVï ôUÜ¡ûù ‘lÚÑ:Æû ]x¡7 Ò¤·1± Ù , C>ÐGJzÛ ÎÍoCêÛ<¾µ l‡å
> > Çë•üŠ©ûlc;6½z¶ýê( bþ&Ï«O𤽉üœ[}cþùtç b ‡ ÓËÐ)7bß'vÿ[#ß.€ÒÃûQÖ¼? Ç
> > VªóªømOCäsn~?é ®™9Úž²çýÄ ŸVkΫùTÐÞ® ¹ ÷¶¿“k¯¥Ÿ|Šm›Ÿ‚_#ýÝXéóiOm_&· ù>ù Ëw—
> > †Có$µ Á ÇV Jxq4 û 9Ùµ ýRýâézϪ- V÷®fÞ%%¤ü$žÍ´ñqÓ¹É)ê pêE$Z6·÷¹ íÖK4NÖâÓK
> > H|a¶‰ZˆÂ~qÁë éåKÚ;J^v“¨dJ’ú».Ð9:jÀញ TqÀr ^[¨öÏ}òV·íÚr2ÂœJx„þ‘ùî ƒ
> ý¤Î–[L+
> > ²=¶ØÂYŠÂwP‘ûÉ=I™­ŒÍ!aÓ»IÑŒZ-­0ÓÞZ§BŠœß)g)'xžGˆ©1‹d(÷ 7 c6‰’’„¾ð rÂF Ud[aI
> > sñ›rTMÿ'uCÎo|aXôŽ [iù5¼qèÏ·ðȦ¹ ꇿWWòÕÉðb\¢9 á ™1œÆû/ )*Á d ²¯) R jH(#
> $pÇu
> > nÇ3ý ÙsŸîÜçëWVt F±× ‰ ^Ñâ>¬Ó ¾ Kd6áÛã5 3...@„4Òwrœ’n ¤“í¢-º I dEŒÓOJP[î!8SŠ
> > ¨õáA“E P QE H»QÙë Ò ^Œ[bï $0ò‡ Ïq~ â BOy§ª(8®óg¸Øç. Ú#±d ñCƒŸˆ<ˆñ *FûŸ,
> > ŸªÝ»¸Ùò{sGu];U Ð?˾ eH»vü ¦¯å5] ~@'õ§?‚h$Š(¢€¢Š( (¢€¢©U (ªUh (¢ƒÿÙ', '',
> '',
> > '', '', '', '')
> >
> > MySQL complains about the image in string form. I'm sure the solution is
> > simple, but I don't know what it is.
>
> Are you looking for MySQLdb.string_literal(val) ?
>
> Regards
>
> Bram
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to