Can't Encode Pic
victorsubervi at gmail.com
Fri Nov 27 19:26:18 CET 2009
On Fri, Nov 27, 2009 at 1:43 PM, Dennis Lee Bieber <wlfraed at ix.netcom.com>wrote:
> On Fri, 27 Nov 2009 05:59:39 -0500, Victor Subervi
> <victorsubervi at gmail.com> declaimed the following in
> > >
> > > The following complained that there weren't enough arguments:
> > for pic in pics:
> > sql = 'update %s set %s=%%s where ID=%s;' % (t, colNamesPics[i],
> > '%s', str(id))
> > cursor.execute(sql, (MySQLdb.Binary(pics[int(i)]),), )
> I'm pretty sure that isn't what I had typed too... Count the %
> sql = "update %s set %s=%%s where ID = %%s" % (t, colNamesPics[i])
Thank you, Dennis. This problem is resolved. Since our posts most likely
crossed, and since yours has inadvertently appeared below mine with the
latest problem, I'm reposting it here:
Now, I have this line of code on another page that calls the images once the
database is populated:
print '<img src="getpic.py?pic=%d&id=%d" width="100"></td>\n'
% (a, w)
This is looped through for every value of pic/id returned from the database,
producing the following code on the Web page:
<img src="getpic.py?pic=1&id=1" width="100"></td>
<img src="getpic.py?pic=1&id=2" width="100"></td>
The problem here is that only one of the images prints on the said page!
However, if I surf to those URLs, the images appear! Is it possible that
because I'm passing values to the variables and perhaps simultaneously
calling the script, that it can only fulfill the first request? Is there a
way around that?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list