473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Re: Prob. w/ Script Posting Last Value

Victor Subervi wrote:
Hi;
Gabriel provided a lovely script for showing images which I am modifying
for my needs. I have the following line:

print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)
where the correct values are entered for the variables, and those values
increment (already tested). Here is the slightly modified script it calls:
#!/usr/local/bin/python
import cgitb; cgitb.enable()
import MySQLdb
import cgi
form = cgi.FieldStorage()
picid = int(form["id"].value)
x = int(form["x"].value)
pic = str(x)
print 'Content-Type: text/html'
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=db)
cursor= db.cursor()
sql = "select " + pic + " from products where id='" + str(picid) + "';"
cursor.execute(sql)
content = cursor.fetchall()[0][0].tostring()
cursor.close()
print 'Content-Type: image/jpeg\r\nContent-Length: %s\n' % len(content)
print content

I need to make it so that it will show all my images, not just the last
one. Suggestions, please.
TIA,
Victor
In your "page generator" page, replace

print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)

by

for d, y in (results of some DB query to get d and y for each image):
print '<img src="getpic.py?id=%d&x=%d"><br /><br /></td>\n' % (d, y)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Jun 27 '08 #1
0 921

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fred | last post by:
This script was left to me to get fixed, but since i cannot vb, i stuck. Anyone know what i have to do to make it work? <package> <job id="vbs"> <script language="VBScript"> Set WshNetwork =...
2
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
5
by: Steve | last post by:
Hi, I have a private website for 20 people that is similar to a web email client like hotmail. There are two frames, one on the left with links for "New", "History", "Todays" and a frame on the...
6
by: oeyvind toft | last post by:
I have a frameset consisting of 3 frames: top, left and right. In top frame: body onload calls a js init function to set (or resets) values in textareas etc...in all frames. In right frame: A...
5
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
15
by: Raj | last post by:
Hello all: We have a table with about 2400 cells. Our requirement is to highlight the cells in the table whose data has changed, every 5 seconds. Our script behaves relatively ok in Firefox, but...
4
by: Luklrc | last post by:
Hi, I'm having to create a querysting with javascript. My problem is that javscript turns the "&" characher into "&amp;" when it gets used as a querystring in the url EG: ...
2
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so...
1
by: mahajanrahuld | last post by:
hi i written the script for database connectivity with ms access , connection is proper but the script can not display any reslut on browser ..... code is ..... #!usr/bin/perl use...
0
by: Gabriel Genellina | last post by:
En Thu, 17 Apr 2008 15:51:43 -0300, Victor Subervi <victorsubervi@gmail.comescribió: That 'Content-Type: text/html' is wrong, you're returning an image here. Are you sure that *different*...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.