Hi;<br>I have the following archaic code that worked just fine for another site. It is called with the following url:<br><br><a href="http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1">http://13gems.com/stxresort/cart/getpic1.py?id=1&x=1</a><br>
<br>#!/usr/local/bin/python<br>import cgitb; cgitb.enable()<br>import MySQLdb<br>import cgi<br>import sys,os<br>sys.path.append(os.getcwd())<br>from login import login<br>user, passwd, db, host = login()<br>form = cgi.FieldStorage()<br>
picid = int(form['id'].value)<br>x = int(form['x'].value)<br>pics = {1:'pic1',2:'pic2',3:'pic3',4:'pic4',5:'pic5',6:'pic6'}<br>pic = pics[x]<br>print 'Content-Type: text/html'<br>
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)<br>cursor= db.cursor()<br>sql = "select " + pic + " from products where id='" + str(picid) + "';"<br>cursor.execute(sql)<br>
content = cursor.fetchall()[0][0].tostring()<br>cursor.close()<br>print 'Content-Type: image/jpeg'<br>print<br>print content<br><br>Now, the data is in the database:<br>[BLOB - 64.0 KB]<br><br>and I can get it to print out as a string. Why doesn't it show the image?<br>
TIA,<br>Victor<br>